3 ms·
I agree, its not a great idea to use unwrap() in production code, it is bad even when its safe to unwrap. But speaking about blogs... Why not to use .unwrap()
by ordu 10y ago
I agree, its not a great idea to use unwrap() in production code, it is bad even when its safe to unwrap.
But speaking about blogs... Why not to use .unwrap() there? Its simple, and allows to show some ideas without digging into error handling, just point to places where those handling should be placed.
> but if you're gonna have unwrap, you basically have to have exceptions as well (or some kind of panic recovery) ...
https://doc.rust-lang.org/1.9.0/std/panic/fn.catch_unwind.html https://doc.rust-lang.org/1.9.0/std/panic/fn.catch_unwind.ht...