What's the best practice here? Is "responsible" enforceable with rust semantics? cc: @nick_r_cameron @aaron_turonhttps://twitter.com/upsuper/status/818312114158698498 …
-
-
Replying to @junglecode @aaron_turon
best practice is TBD, ideally, you would never use `unwrap` in production code. But realistically, sometimes ...
1 reply 0 retweets 1 like -
Replying to @nick_r_cameron
... you have to. Should only be used when it is 'impossible' to go wrong. My rule of thumb is that should be obvious from the previous 5 ...
2 replies 0 retweets 1 like -
Replying to @nick_r_cameron
Even then shouldn't it be `match expr { Some(x) => x, None => unreachable!()`?
2 replies 0 retweets 0 likes -
Replying to @sgrif @nick_r_cameron
that's the same as an unwrap; the only difference is the message
2 replies 0 retweets 1 like -
Replying to @steveklabnik @nick_r_cameron
Unwrap has never really said to me "this never fails"
2 replies 0 retweets 0 likes -
Replying to @sgrif @nick_r_cameron
that's why i wanted to call it assert but people Got Mad at that soooo
1 reply 0 retweets 2 likes -
imo if there's any possibility of failure you should be using `expect`.
2 replies 0 retweets 2 likes
oh my god I'm glad other people agree with me. `unwrap` doesn't exist; there is only `expect`.
-
-
Replying to @JakeGoulding @steveklabnik and
unwrap exists, it's just sugar for .expect("impossibru") ;)
1 reply 0 retweets 1 like -
Replying to @Gankra_ @steveklabnik and
nah. Put unique text in each one so you can grep for exact line of failure without debugger.
1 reply 0 retweets 0 likes - 4 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.