this post was submitted on 01 Aug 2025
148 points (96.8% liked)
Programmer Humor
25425 readers
2006 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I mean using unwrap is not bad practice if the value is guaranteed to not be none, which can happen frequently in some applications.
If it's guaranteed to not be
None
, why is it anOption
?Oh, it can happen when you do calculations with compile-time constants...
But the GP's claim that it's a "frequent" thing is suspect.
(Crashing is also useful when you are writing and-user applications, but you'll probably want .expect like in the meme.)
A good example would be regex. After validating it when writing the program it should always compile, although this could also be solved with a proc macro that validates the regex at compile time.