needless_collect triggers inside for loop, can be questionable #6909
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
L-nursery
Lint: Currently in the nursery group
Right now, we are running the expensive closure only N (vec.len() times.
If we move it into into the
for-loop
, this could easily becomeN (vec.len() * M (for loop)
timesit might be cheaper to just run the closure once up front for all the elements and "cache" the results in the vec.
The text was updated successfully, but these errors were encountered: