map_entry false positive when map needs to be used while still borrowed by the entry #4674
Labels
C-bug
Category: Clippy is not doing the correct thing
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
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
Hello, thanks for developing clippy! Ran into this (I believe) false positive in the
map_entry
lint:The following function triggers the lint, but the suggestion (using entry) correctly triggers a borrowchecker error due to the map being borrowed by the entry.
The value computation can not be moved before the lookup - the point of the lookup is to prevent the computation from happening.
Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=16a29ebce3e1f3ce4fdd5676052e6914
Clippy version:
clippy 0.0.212 (3aea8603 2019-09-03)
The text was updated successfully, but these errors were encountered: