Skip to content

Commit

Permalink
fix(config): Improve output from --dump-config
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Page committed Apr 8, 2021
1 parent 8d02a86 commit b8294d7
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b8294d7

Please sign in to comment.