Open
Description
If T
in Result<T, _>
is not fmt::Debug
, the following will fail to compile. The compiler rightfully blames fmt::Debug
not being implemented for Result<Foo, ()>
.
struct Foo;
Result::<Foo, _>::Err(()).expect_err("Foo!");
However, users may get stuck if they can't - for whatever reason - add fmt::Debug
. A simple workaround is
Result::<Foo, _>::Err(()).err().expect("Foo!");
which has a somewhat degraded error message in the panic case, yet does what it's being asked for. Maybe the compiler could suggest that?