Post

If "everyone knows .unwrap() is a footgun", then why is it in #rust at all? Make the user use .unwrap_or, or match, or some other error flow mechanism so they're forced to make a decision. If they want to "panic!()", make them type it out. Let them ponder their life choices in those 9 chrs.

The goal of rust was to remove footguns, so I guess I'm surprised that this was allowed in the language in the first place. The goal of statically typed languages is to move problems from runtime to compile-time. Any crashes are bugs in the compiler, not your code. Maybe deprecate unwrap()?

0 reposts3 likes

No replies yet.