Invalid suggestion of or_fun_call
causes a compiler error error[E0277]: expected a
FnOnce<()> closure, found
Vec<_>``
#6748
Labels
C-bug
Category: Clippy is not doing the correct thing
good-first-issue
These issues are a good way to get started with Clippy
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Lint name: or_fun_call
I tried this code:
I expected to see this happen: suggestion to use
or_insert_with(|| vec![])
instead ofor_insert(vec![])
Instead, this happened: clippy suggested me to use
or_insert_with(vec![])
and that suggestion causes the compiler error.
Playground link
I found that this only happens when the vector is empty.
When it is not, the suggestion is correct:
Meta
The text was updated successfully, but these errors were encountered: