Could `std::Result<T, E1>` implement `From<Result<T, E2>>` where `E2: Into<E1>`? It would mean being able to write `r.into()` rather than `r.map_err(Into::into)`.
2
9
I bet it falls foul of some specialisation rule or something.
2
I imagine this is something that try blocks and ? might make a bit less messy in the future.
1
If you can use a ? today, it's fine, but sometimes you just want an unconditional return, and then you have to use the map_err incantation, which sucks.
1
This makes Clippy sad. Also it makes me sad
1
Replying to @nick_r_cameron
Time to break out the macro_rules!() return eugh!(r); where eugh!(expr) => match expr { v @ Ok(_) => v, Err(e) => Err(e.into()) } Or the .map_err(Into::into) I suppose. Such sadness.

Dec 16, 2019 ยท 9:48 PM UTC

1