News for hackers. Stuff that matters.
Re:Small exercises to get you used to reading and writing Ru... by lhnz on Tuesday February 02, 2016 @12:56PM (#11021076)
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.

There are no comments on this comment yet.