aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-09-02 16:02:10 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-09-02 16:02:10 +0200
commit6aa485ec0892125e9b67085afb400bc9e27e6a8d (patch)
tree6ae6542c20b7dccaba66244505666f3546217720 /askama_derive
parentf29c12f469ccb76ed06aff6d6dc037dfd7dd2406 (diff)
downloadaskama-6aa485ec0892125e9b67085afb400bc9e27e6a8d.tar.gz
askama-6aa485ec0892125e9b67085afb400bc9e27e6a8d.tar.bz2
askama-6aa485ec0892125e9b67085afb400bc9e27e6a8d.zip
Fix formatting with cargo fmt
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs17
-rw-r--r--askama_derive/src/lib.rs3
2 files changed, 13 insertions, 7 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index a64d72d..b771234 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -147,7 +147,8 @@ impl<'a> Generator<'a> {
buf.writeln("fn modify(self, res: &mut ::askama::iron::Response) {");
buf.writeln("res.body = Some(Box::new(self.render().unwrap().into_bytes()));");
- let ext = self.input
+ let ext = self
+ .input
.path
.extension()
.map_or("", |s| s.to_str().unwrap_or(""));
@@ -429,14 +430,16 @@ impl<'a> Generator<'a> {
let def = if let Some(s) = match scope {
None => match level {
AstLevel::Nested(s) => s,
- _ => None
+ _ => None,
},
s => s,
} {
- let path = ctx.imports
+ let path = ctx
+ .imports
.get(s)
.unwrap_or_else(|| panic!("no import found for scope '{}'", s));
- let mctx = self.contexts
+ let mctx = self
+ .contexts
.get(path)
.unwrap_or_else(|| panic!("context for '{:?}' not found", path));
mctx.macros
@@ -471,7 +474,8 @@ impl<'a> Generator<'a> {
fn handle_include(&mut self, ctx: &'a Context, buf: &mut Buffer, ws: WS, path: &str) {
self.flush_ws(buf, ws);
- let path = self.input
+ let path = self
+ .input
.config
.find_template(path, Some(&self.input.path));
let src = get_template_source(&path);
@@ -539,7 +543,8 @@ impl<'a> Generator<'a> {
self.super_block = Some(cur);
// Get the block definition from the heritage chain
- let heritage = self.heritage
+ let heritage = self
+ .heritage
.as_ref()
.unwrap_or_else(|| panic!("no block ancestors available"));
let (ctx, def) = heritage.blocks[cur.0]
diff --git a/askama_derive/src/lib.rs b/askama_derive/src/lib.rs
index f977b19..5591b82 100644
--- a/askama_derive/src/lib.rs
+++ b/askama_derive/src/lib.rs
@@ -103,7 +103,8 @@ impl<'a> Heritage<'a> {
mut ctx: &'n Context<'n>,
contexts: &'n HashMap<&'n PathBuf, Context<'n>>,
) -> Heritage<'n> {
- let mut blocks: BlockAncestry<'n> = ctx.blocks
+ let mut blocks: BlockAncestry<'n> = ctx
+ .blocks
.iter()
.map(|(name, def)| (*name, vec![(ctx, *def)]))
.collect();