From 6729bf9f7ca89ff0344dc943152b5e242ab6a73f Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 6 Apr 2021 21:08:01 -0500 Subject: [PATCH] refactor(config): Open door for other mutable operations --- src/policy.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/policy.rs b/src/policy.rs index cded1c9..7a80a04 100644 --- a/src/policy.rs +++ b/src/policy.rs @@ -149,16 +149,14 @@ impl<'s> ConfigEngine<'s> { let walk = self.walk.intern(files); - let types = type_ - .into_iter() - .map(|(type_, type_engine)| { - let mut new_type_engine = default.clone(); - new_type_engine.update(&type_engine); - new_type_engine.update(&overrides); - let type_config = self.init_file_config(new_type_engine); - (type_, type_config) - }) - .collect(); + let mut types: std::collections::HashMap<_, _> = Default::default(); + for (type_name, type_engine) in type_.into_iter() { + let mut new_type_engine = default.clone(); + new_type_engine.update(&type_engine); + new_type_engine.update(&overrides); + let type_config = self.init_file_config(new_type_engine); + types.insert(type_name, type_config); + } default.update(&overrides); let default = self.init_file_config(default);