From fdf1136e7963ecb72db9681ce1ffe53d1e46e739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Sun, 2 Jan 2022 12:03:34 +0200 Subject: [PATCH] Replace folds with for loops --- .../src/handlers/extract_module.rs | 19 +++++++++---------- .../src/handlers/generate_function.rs | 8 ++++---- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/crates/ide_assists/src/handlers/extract_module.rs b/crates/ide_assists/src/handlers/extract_module.rs index 4bbfdae1d21..6cc311fd758 100644 --- a/crates/ide_assists/src/handlers/extract_module.rs +++ b/crates/ide_assists/src/handlers/extract_module.rs @@ -311,18 +311,17 @@ fn change_visibility(&self, record_fields: Vec) -> Option) { - let arg_name_counts = arg_names.iter().fold(FxHashMap::default(), |mut m, name| { - *m.entry(name).or_insert(0) += 1; - m - }); + let mut arg_name_counts = FxHashMap::default(); + for name in arg_names.iter() { + *arg_name_counts.entry(name).or_insert(0) += 1; + } let duplicate_arg_names: FxHashSet = arg_name_counts .into_iter() .filter(|(_, count)| *count >= 2)