Skip to content

Commit

Permalink
Auto merge of #5798 - mikerite:fix-2277-2, r=yaahc
Browse files Browse the repository at this point in the history
Add test for `needless_range_loop` issue

Closes #2277

This was fixed when we fixed #2542.

changelog: none
  • Loading branch information
bors committed Jul 14, 2020
2 parents 128c5de + d067d03 commit 84cdce0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/ui/needless_range_loop2.rs
Original file line number Diff line number Diff line change
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 84cdce0

Please sign in to comment.