You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for i in 0..10 {
let mut id_col = vec![0f64; 10];
id_col[i] = 1f64;
// Do something with my id_col...
}
This triggers the needless_range_loop:
warning: the loop variable i is only used to index id_col. Consider using for item in id_col.iter().take(self.rows) or similar iterators, #[warn(needless_range_loop)] on by default
But id_col does not exist outside of the loop.
I'm sure the code is terribly inefficient and I'd love a better way to do it but I think the lint isn't behaving correctly here.
Note: I edited the above example. In my original source code I'm using generics - I assume that won't make a difference.
The text was updated successfully, but these errors were encountered:
I have some code like this:
This triggers the needless_range_loop:
warning: the loop variable
i
is only used to indexid_col
. Consider usingfor item in id_col.iter().take(self.rows)
or similar iterators, #[warn(needless_range_loop)] on by defaultBut
id_col
does not exist outside of the loop.I'm sure the code is terribly inefficient and I'd love a better way to do it but I think the lint isn't behaving correctly here.
Note: I edited the above example. In my original source code I'm using generics - I assume that won't make a difference.
The text was updated successfully, but these errors were encountered: