The Unclear Impact

I think one of the things I would do if I could go back and time and change rust is rename .expect() to something like .unwrap_or_panic() because people keep thinking that the string you're supposed to put in it is what you're expecting rather than the error message on failure, which is why we have ".expect("password")" which kinda makes sense when reading the code but then you get the error in the log output and all the information you have is just the word "password" so good luck figuring out what that was about

istg the amount of times my pull requests at work included changes like

- .get_something().expect("something")
+ .get_something().expect("Unable to get something")

@AgathaSorceress The worst I've ever seen was

-
foo().expect("panic")

when I first started learning rust I got confused by .expect() for a week or so but eventually figured out that the string you give it is the error message, but unfortunately that doesn't mean that everyone else also figured that out and that you're not gonna run into people doing single word error messages

@spacekookie @AgathaSorceress I-don't-know-what-I-expected dot webpee

panic

@spacekookie @AgathaSorceress expect to panic! blobfoxshocked ablobfoxdundundunowo

replies
0
announces
0
likes
2