From 591f44c493621ef8b483fd04f75b9fab5f70fb06 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Wed, 2 Oct 2024 23:38:33 +0200 Subject: [PATCH] style: use explicit loop instead of `.for_each()` in simple cases --- Cargo.toml | 1 + cli/src/movement_util.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 21bebcbaa0..d70cceb189 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -137,6 +137,7 @@ all = "deny" explicit_iter_loop = "deny" flat_map_option = "deny" implicit_clone = "deny" +needless_for_each = "deny" semicolon_if_nothing_returned = "deny" # Until all documentation comments are fixed, do not warn about them too_long_first_doc_paragraph = { level = "allow", priority = 1 } diff --git a/cli/src/movement_util.rs b/cli/src/movement_util.rs index eadc059a3b..9d5913a804 100644 --- a/cli/src/movement_util.rs +++ b/cli/src/movement_util.rs @@ -101,7 +101,7 @@ impl Direction { let template = workspace_command.commit_summary_template(); let mut cmd_err = user_error(err_msg); - commits.iter().for_each(|commit| { + for commit in commits { cmd_err.add_formatted_hint_with(|formatter| { if args.should_edit { write!(formatter, "Working copy: ")?; @@ -110,7 +110,7 @@ impl Direction { } template.format(commit, formatter) }); - }); + } cmd_err }