Skip to content

Commit d067d03

Browse files
author
Michael Wright
committed
Add test for needless_range_loop issue
Closes #2277 This was fixed when we fixed #2542.
1 parent 4b87008 commit d067d03

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/ui/needless_range_loop2.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,13 @@ fn main() {
8383
println!("{}", arr[i]);
8484
}
8585
}
86+
87+
mod issue2277 {
88+
pub fn example(list: &[[f64; 3]]) {
89+
let mut x: [f64; 3] = [10.; 3];
90+
91+
for i in 0..3 {
92+
x[i] = list.iter().map(|item| item[i]).sum::<f64>();
93+
}
94+
}
95+
}

0 commit comments

Comments
 (0)