Skip to content

Commit fbc8f7c

Browse files
committed
sim: Directly iterate instead of using an index
From a clippy suggestion, replace an index iterator over a slice, and directly use a mutable iterator over the slice. Signed-off-by: David Brown <david.brown@linaro.org>
1 parent aec56b2 commit fbc8f7c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sim/src/image.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,15 +1130,15 @@ impl Images {
11301130
let mut rng = rand::thread_rng();
11311131
let mut resets = vec![0i32; count];
11321132
let mut remaining_ops = total_ops;
1133-
for i in 0 .. count {
1133+
for reset in &mut resets {
11341134
let reset_counter = rng.gen_range(1, remaining_ops / 2);
11351135
let mut counter = reset_counter;
11361136
match c::boot_go(&mut flash, &self.areadesc, Some(&mut counter), false) {
11371137
(0, _) | (-0x13579, _) => (),
11381138
(x, _) => panic!("Unknown return: {}", x),
11391139
}
11401140
remaining_ops -= reset_counter;
1141-
resets[i] = reset_counter;
1141+
*reset = reset_counter;
11421142
}
11431143

11441144
match c::boot_go(&mut flash, &self.areadesc, None, false) {

0 commit comments

Comments
 (0)