Skip to content

Commit

Permalink
Add test for needless_range_loop issue
Browse files Browse the repository at this point in the history
Closes #2277

This was fixed when we fixed #2542.
  • Loading branch information
Michael Wright committed Jul 14, 2020
1 parent 4b87008 commit d067d03
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/ui/needless_range_loop2.rs
Expand Up @@ -83,3 +83,13 @@ fn main() {
println!("{}", arr[i]);
}
}

mod issue2277 {
pub fn example(list: &[[f64; 3]]) {
let mut x: [f64; 3] = [10.; 3];

for i in 0..3 {
x[i] = list.iter().map(|item| item[i]).sum::<f64>();
}
}
}

0 comments on commit d067d03

Please sign in to comment.