Nightly clippy is a bit smarter and recognizes one more loop
that it wants to be written with iterators.

Signed-off-by: Paolo Bonzini <[email protected]>
---
 rust/hw/timer/hpet/src/device.rs | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/rust/hw/timer/hpet/src/device.rs b/rust/hw/timer/hpet/src/device.rs
index ec0bca4496d..89ba7a5c4d2 100644
--- a/rust/hw/timer/hpet/src/device.rs
+++ b/rust/hw/timer/hpet/src/device.rs
@@ -938,9 +938,7 @@ fn post_load(&self, _version_id: u8) -> Result<(), 
migration::Infallible> {
         let mut regs = self.regs.borrow_mut();
         let cnt = regs.counter;
 
-        for index in 0..self.num_timers {
-            let tn_regs = &mut regs.tn_regs[index];
-
+        for tn_regs in regs.tn_regs.iter_mut().take(self.num_timers) {
             tn_regs.update_cmp64(cnt);
             tn_regs.last = CLOCK_VIRTUAL.get_ns() - NANOSECONDS_PER_SECOND;
         }
-- 
2.55.0


Reply via email to