Wrong recommendation for needless_range_loop
if loop variable is used in closure
#2542
Labels
C-bug
Category: Clippy is not doing the correct thing
Clippy falsely warns about a needless range loop, if the loop variable is (aside from indexing) only used inside a closure. The following example triggers the false positive:
This could be written as
But clippy says to use
for <item> in arr.iter_mut().take(len) {
Tested with
rustc 1.25.0-nightly (3ec5a99aa 2018-02-14)
and clippy0.0.186
.The text was updated successfully, but these errors were encountered: