Use iterator instead of for loop
This commit is contained in:
parent
592140db5b
commit
92a7b0cdcd
|
@ -343,18 +343,16 @@ impl MDBook {
|
||||||
|
|
||||||
/// Look at the `Config` and try to figure out what renderers to use.
|
/// Look at the `Config` and try to figure out what renderers to use.
|
||||||
fn determine_renderers(config: &Config) -> Vec<Box<dyn Renderer>> {
|
fn determine_renderers(config: &Config) -> Vec<Box<dyn Renderer>> {
|
||||||
let mut renderers: Vec<Box<dyn Renderer>> = Vec::new();
|
let mut renderers = Vec::new();
|
||||||
|
|
||||||
if let Some(output_table) = config.get("output").and_then(Value::as_table) {
|
if let Some(output_table) = config.get("output").and_then(Value::as_table) {
|
||||||
for (key, table) in output_table.iter() {
|
renderers.extend(output_table.iter().map(|(key, table)| {
|
||||||
// the "html" backend has its own Renderer
|
|
||||||
if key == "html" {
|
if key == "html" {
|
||||||
renderers.push(Box::new(HtmlHandlebars::new()));
|
Box::new(HtmlHandlebars::new()) as Box<dyn Renderer>
|
||||||
} else {
|
} else {
|
||||||
let renderer = interpret_custom_renderer(key, table);
|
interpret_custom_renderer(key, table)
|
||||||
renderers.push(renderer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we couldn't find anything, add the HTML renderer as a default
|
// if we couldn't find anything, add the HTML renderer as a default
|
||||||
|
|
Loading…
Reference in New Issue