aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-09-26 21:40:15 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-09-26 21:40:15 +0200
commit531e77eb36ee728630631da303af4761629980a3 (patch)
treee4d0f4f9b4189e0ac53808863cfcc4ab0b0b0cc2
parent1d914727b137b684edd0d64e6d0b30ab155fa87c (diff)
downloadaskama-531e77eb36ee728630631da303af4761629980a3.tar.gz
askama-531e77eb36ee728630631da303af4761629980a3.tar.bz2
askama-531e77eb36ee728630631da303af4761629980a3.zip
Improve code compactness
Diffstat (limited to '')
-rw-r--r--askama_shared/src/lib.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/askama_shared/src/lib.rs b/askama_shared/src/lib.rs
index a7deaff..2feff75 100644
--- a/askama_shared/src/lib.rs
+++ b/askama_shared/src/lib.rs
@@ -38,11 +38,10 @@ pub fn build_template(ast: &syn::DeriveInput) -> String {
let data = input::TemplateInput::new(ast);
let nodes = parser::parse(data.source.as_ref());
let imports = Imports::new(&nodes, &data.path);
- let imported = imports.parse();
if data.meta.print == Print::Ast || data.meta.print == Print::All {
println!("{:?}", nodes);
}
- let code = generator::generate(&data, &nodes, &imported);
+ let code = generator::generate(&data, &nodes, &imports.macro_map());
if data.meta.print == Print::Code || data.meta.print == Print::All {
println!("{}", code);
}
@@ -66,9 +65,7 @@ impl <'a> Imports<'a> {
_ => None,
}
}).collect();
- Imports {
- sources,
- }
+ Imports { sources }
}
pub fn parse(&'a self) -> HashMap<&'a str, Macro<'a>> {