3 ms·
But then again, there are some gotchas. Runtime errors can happen when using unwrap like in every example around the Internet. I too used the unwrap everywhere
by pimeys 10y ago
But then again, there are some gotchas. Runtime errors can happen when using unwrap like in every example around the Internet. I too used the unwrap everywhere when I started writing Rust, but soon realized that one must handle the results and everything can be an Err or None, even if you think it is not possible.
I'd say beginner tutorials should UNDERLINE that the use of unwrap() is just for the first prototype and you must refactor them out to proper error handling.