From bbbbc4aac58460610cbab362d39c078c72109707 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 4bda1245b7..473d64745b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -136,6 +136,7 @@ testutils = { path = "lib/testutils" } explicit_iter_loop = "deny" flat_map_option = "deny" implicit_clone = "deny" +needless_for_each = "deny" redundant_else = "deny" semicolon_if_nothing_returned = "deny" uninlined_format_args = "deny" 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 }