map_entry false positive when returning before inserting #4664
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 want to check if a hashmap contains a key, and if it does not, I want to either return from the function early, or insert a value for that key, based on some logic.
Clippy complains that that using
map.entry(key)
will be more efficient, but I suspect this is a false positive in this case, since moving thereturn
to inside the closure of.or_insert_with()
will just return from the closure rather than the function.The text was updated successfully, but these errors were encountered: