Suggest .err().expect() if .expect_err() is not implemented #65019
Labels
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
If
T
inResult<T, _>
is notfmt::Debug
, the following will fail to compile. The compiler rightfully blamesfmt::Debug
not being implemented forResult<Foo, ()>
.However, users may get stuck if they can't - for whatever reason - add
fmt::Debug
. A simple workaround iswhich has a somewhat degraded error message in the panic case, yet does what it's being asked for. Maybe the compiler could suggest that?
The text was updated successfully, but these errors were encountered: