Hacker News new | ask | show | jobs
by p1necone 403 days ago
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.")

2 comments

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.