Hacker News new | past | comments | ask | show | jobs | submit login

Often the quickest replacement for an `unwrap` is an `unwrap_or` with a sensible default.

Other times where error-handling is important use a `match` there and then. And don't nest the arms of the match instead use the return of the match expression.

On the other hand, I found `try!` pretty awkward. Especially since quite often you need to create custom errors alongside it and can go down a rabbit hole in which you have to read confusing compiler messages from within macros about traits not being implemented correctly, and lifetimes missing, etc.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: