From c582ebc616b493fd7c3980ad7cdae0b344347bdc Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sun, 11 Dec 2022 07:02:51 +0000 Subject: [PATCH] use implicit iter loops --- src/multi.rs | 6 +++--- src/state.rs | 4 ++-- src/style.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/multi.rs b/src/multi.rs index 20eb933d..dafdf78f 100644 --- a/src/multi.rs +++ b/src/multi.rs @@ -251,7 +251,7 @@ impl MultiState { // Reap all consecutive 'zombie' progress bars from head of the list. let mut adjust = 0; - for &index in self.ordering.iter() { + for &index in &self.ordering { let member = &self.members[index]; if !member.is_zombie { break; @@ -299,7 +299,7 @@ impl MultiState { // Add lines from `ProgressBar::println` call. draw_state.lines.append(&mut self.orphan_lines); - for index in self.ordering.iter() { + for index in &self.ordering { let member = &self.members[*index]; if let Some(state) = &member.draw_state { draw_state.lines.extend_from_slice(&state.lines[..]); @@ -309,7 +309,7 @@ impl MultiState { drop(draw_state); let drawable = drawable.draw(); - for index in reap_indices.into_iter() { + for index in reap_indices { self.remove_idx(index); } diff --git a/src/state.rs b/src/state.rs index 161b3723..208bc548 100644 --- a/src/state.rs +++ b/src/state.rs @@ -77,7 +77,7 @@ impl BarState { self.state.pos.reset(now); self.state.status = Status::InProgress; - for (_, tracker) in self.style.format_map.iter_mut() { + for tracker in self.style.format_map.values_mut() { tracker.reset(&self.state, now); } @@ -126,7 +126,7 @@ impl BarState { self.state.est.record(pos, now); let _ = self.draw(false, now); - for (_, tracker) in self.style.format_map.iter_mut() { + for tracker in self.style.format_map.values_mut() { tracker.tick(&self.state, now); } } diff --git a/src/style.rs b/src/style.rs index 768a865b..e8946e36 100644 --- a/src/style.rs +++ b/src/style.rs @@ -590,7 +590,7 @@ impl Template { } fn set_tab_width(&mut self, new_tab_width: usize) { - for part in self.parts.iter_mut() { + for part in &mut self.parts { if let TemplatePart::Literal(s) = part { s.set_tab_width(new_tab_width); }