Not at all. This is what the ? operator is for (was try! before).
The idiomatic rust way is to have your own Error type that implements From for other Error types that you may encounter (io::Error, Utf8Error, etc.).
Then you can simply just write let result = dosomething()?; for any operation that may fail. If an error happens, function will return with the error.
I don't think you can do it any cleaner, given the constraints Rust is operating under.
Not at all. This is what the ? operator is for (was try! before).
The idiomatic rust way is to have your own Error type that implements From for other Error types that you may encounter (io::Error, Utf8Error, etc.).
Then you can simply just write let result = dosomething()?; for any operation that may fail. If an error happens, function will return with the error.
I don't think you can do it any cleaner, given the constraints Rust is operating under.