use implicit iter loops (clippy::explicit_iter_loop)

This commit is contained in:
Daniel Eades 2024-04-14 21:09:14 +01:00 committed by Jeremy Soller
parent de6f48a951
commit 89174c5e0d
4 changed files with 10 additions and 10 deletions

View file

@ -292,7 +292,7 @@ impl Config {
let color_schemes = self.color_schemes(color_scheme_kind); let color_schemes = self.color_schemes(color_scheme_kind);
let mut color_scheme_names = let mut color_scheme_names =
Vec::<(String, ColorSchemeId)>::with_capacity(color_schemes.len()); Vec::<(String, ColorSchemeId)>::with_capacity(color_schemes.len());
for (color_scheme_id, color_scheme) in color_schemes.iter() { for (color_scheme_id, color_scheme) in color_schemes {
let mut name = color_scheme.name.clone(); let mut name = color_scheme.name.clone();
let mut copies = 1; let mut copies = 1;
@ -328,7 +328,7 @@ impl Config {
// Get a sorted and adjusted for duplicates list of profile names and ids // Get a sorted and adjusted for duplicates list of profile names and ids
pub fn profile_names(&self) -> Vec<(String, ProfileId)> { pub fn profile_names(&self) -> Vec<(String, ProfileId)> {
let mut profile_names = Vec::<(String, ProfileId)>::with_capacity(self.profiles.len()); let mut profile_names = Vec::<(String, ProfileId)>::with_capacity(self.profiles.len());
for (profile_id, profile) in self.profiles.iter() { for (profile_id, profile) in &self.profiles {
let mut name = profile.name.clone(); let mut name = profile.name.clone();
let mut copies = 1; let mut copies = 1;

View file

@ -746,7 +746,7 @@ impl App {
.into(), .into(),
); );
for error in self.color_scheme_errors.iter() { for error in &self.color_scheme_errors {
sections.push( sections.push(
widget::row::with_children(vec![ widget::row::with_children(vec![
icon_cache_get("dialog-error-symbolic", 16) icon_cache_get("dialog-error-symbolic", 16)
@ -1592,7 +1592,7 @@ impl Application for App {
self.dialog_opt = None; self.dialog_opt = None;
if let DialogResult::Open(paths) = result { if let DialogResult::Open(paths) = result {
self.color_scheme_errors.clear(); self.color_scheme_errors.clear();
for path in paths.iter() { for path in &paths {
let mut file = match fs::File::open(path) { let mut file = match fs::File::open(path) {
Ok(ok) => ok, Ok(ok) => ok,
Err(err) => { Err(err) => {
@ -1831,7 +1831,7 @@ impl Application for App {
config_set!(focus_follow_mouse, focus_follow_mouse); config_set!(focus_follow_mouse, focus_follow_mouse);
} }
Message::Key(modifiers, key) => { Message::Key(modifiers, key) => {
for (key_bind, action) in self.key_binds.iter() { for (key_bind, action) in &self.key_binds {
if key_bind.matches(modifiers, &key) { if key_bind.matches(modifiers, &key) {
return self.update(action.message(None)); return self.update(action.message(None));
} }

View file

@ -26,7 +26,7 @@ pub fn context_menu<'a>(
entity: segmented_button::Entity, entity: segmented_button::Entity,
) -> Element<'a, Message> { ) -> Element<'a, Message> {
let find_key = |action: &Action| -> String { let find_key = |action: &Action| -> String {
for (key_bind, key_action) in key_binds.iter() { for (key_bind, key_action) in key_binds {
if action == key_action { if action == key_action {
return key_bind.to_string(); return key_bind.to_string();
} }

View file

@ -165,7 +165,7 @@ where
// Calculate layout lines // Calculate layout lines
terminal.with_buffer(|buffer| { terminal.with_buffer(|buffer| {
let mut layout_lines = 0; let mut layout_lines = 0;
for line in buffer.lines.iter() { for line in &buffer.lines {
match line.layout_opt() { match line.layout_opt() {
Some(layout) => layout_lines += layout.len(), Some(layout) => layout_lines += layout.len(),
None => (), None => (),
@ -480,7 +480,7 @@ where
view_position, view_position,
metadata_set, metadata_set,
}; };
for glyph in run.glyphs.iter() { for glyph in run.glyphs {
bg_rect.update(glyph, renderer, state.is_focused); bg_rect.update(glyph, renderer, state.is_focused);
} }
bg_rect.fill(renderer, state.is_focused); bg_rect.fill(renderer, state.is_focused);
@ -598,7 +598,7 @@ where
modifiers, modifiers,
.. ..
}) if state.is_focused => { }) if state.is_focused => {
for (key_bind, _) in self.key_binds.iter() { for (key_bind, _) in &self.key_binds {
if key_bind.matches(modifiers, &Key::Named(named)) { if key_bind.matches(modifiers, &Key::Named(named)) {
return Status::Captured; return Status::Captured;
} }
@ -741,7 +741,7 @@ where
key, key,
.. ..
}) if state.is_focused => { }) if state.is_focused => {
for (key_bind, _) in self.key_binds.iter() { for (key_bind, _) in &self.key_binds {
if key_bind.matches(modifiers, &key) { if key_bind.matches(modifiers, &key) {
return Status::Captured; return Status::Captured;
} }