Maybe I’m missing something, but my immediate reaction to this (given that we don’t have catch
) is to just wrap the part that returns a Result
in a separate function.
fn run() -> Result<(), Box<Error>> {
some_stuff()?
}
fn main() {
run().unwrap() // or deal with the Result in some other way
}
This doesn’t seem all that unergonomic to me, and avoids introducing some special case for main()
. Or does everyone think this is too much?