False positive in map_identity #9122
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Summary
With the code below, clippy suggests removing the
map_err()
call. However, in this casemap_err()
is the only thing telling the compiler the type of theE
in the relevantResult<T, E>
, so removing it will result in an error. This lint is machine-applicable, so that generates an error.I guess this regressed from when #8478 was fixed.
Lint Name
map_identity
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen: nothing, or potentially it could instead suggest turbofishing the
Ok()
call, as inOk::<_, std::io::Error>(())
.Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: