Closed
Description
Hey there. First of all: Great work to all the devs. Clippy is a real handy tool when developing in Rust.
Now about my proposal: the needless_range_loop
gives pretty good suggestions even for non default ranges. But if a range loop like the following is linted, one could suggest to use a mutable iterator using iter_mut()
:
for i in 1..arr.len()-1 {
arr[i] = <some_value>;
}
Clippy would suggest something like for <item> in arr.iter().take(arr.len()-1).skip(1) {
but in this case iter_mut()
must be used to assign new values to <item>
. I don't know if there is an easy way to detect cases like this one but I think it would be a great improvement.