map_entry
lint suggested by clippy gives compilation error when key is also used in else block
#13306
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
Summary
Clippy gives incorrect suggestion of
entry
api when usingcontains_key
followed byinsert
. The suggestion given causes compilation error because of key being used by else block which has already got moved whenentry
method is called in the if condition.Reproducer
When running clippy with the following input:
gives:
Accepting this suggestion using
--fix
gives error.Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: