From b8294d7afaa4cc9ae4bc941c9199e96bcc6a7a7d Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 7 Apr 2021 20:49:30 -0500 Subject: [PATCH] fix(config): Improve output from --dump-config --- src/policy.rs | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/policy.rs b/src/policy.rs index 044886f..ea789be 100644 --- a/src/policy.rs +++ b/src/policy.rs @@ -131,6 +131,26 @@ impl<'s> ConfigEngine<'s> { config.update(overrides); } + let mut types = Default::default(); + std::mem::swap(&mut types, &mut config.type_); + + let mut types = types + .into_iter() + .map(|(type_, type_engine)| { + let mut new_engine = config.default.clone(); + new_engine.update(&type_engine.engine); + new_engine.update(&config.overrides); + let new_type_engine = crate::config::TypeEngineConfig { + extend_glob: type_engine.extend_glob, + engine: new_engine, + }; + (type_, new_type_engine) + }) + .collect(); + std::mem::swap(&mut types, &mut config.type_); + + config.default.update(&config.overrides); + Ok(config) } @@ -167,10 +187,7 @@ impl<'s> ConfigEngine<'s> { } } - let mut new_type_engine = default.clone(); - new_type_engine.update(&type_engine.engine); - new_type_engine.update(&overrides); - let type_config = self.init_file_config(new_type_engine); + let type_config = self.init_file_config(type_engine.engine); types.insert(type_name, type_config); } default.update(&overrides);