map_entry makes a suggestion that has different behaviour #5176
Labels
C-bug
Category: Clippy is not doing the correct thing
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
T-async-await
Type: Issues related to async/await
The suggestion always calls
fetch_value()
, whereas the code as written only calls it ifthings.contains_key(&key)
returnsfalse
.Normally, it would be better if the suggestion was
.or_insert_with()
, but in this case a future is being awaited which won't work inside the closure, so I'm not sure there is any good suggestion that can be made.The text was updated successfully, but these errors were encountered: