equatable_if_let
suggests wrong code when it involves a reference
#8710
Labels
C-bug
Category: Clippy is not doing the correct thing
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
L-nursery
Lint: Currently in the nursery group
Summary
equatable_if_let
tries to replace a pattern into a==
, but the two differ slightly in their semantics when it comes to reference. Hence the current implementation creates a suggestion that causes a type mismatch error when adopted.Reproducer
I tried this code:
I expected to see this happen: Clippy suggests
Instead, this happened: Clippy suggested
which is a wrong suggestion because replacing the original code with this snippet causes a type error.
Version
Additional Labels
@rustbot label +l-suggestion-causes-error
The text was updated successfully, but these errors were encountered: