Skip to content

Comment on Don't unwrap options: There are better ways (2024)parent

Comments

Imo always expect rather than unwrap in those cases. If it's justifiable, you should justify it in the message.

("This should never happen because: ..., if you see this message there's a bug.")

Or let-else with a panic!() in the else {} if you want to use a format string.

If you’re doing something like Project Euler, writing error messages is a waste of time.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.