diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2018-04-12 19:49:16 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2018-04-12 19:49:51 +0200 |
commit | e46e2d6b02394eea8ffe7ac723469b9b114e234c (patch) | |
tree | c0c0d05e736a8a474f1f01cd1a1f8770a8e8bd46 /askama_shared/src/generator.rs | |
parent | e03df3d9690e228a7a076107d64057c28d63cdfa (diff) | |
download | askama-e46e2d6b02394eea8ffe7ac723469b9b114e234c.tar.gz askama-e46e2d6b02394eea8ffe7ac723469b9b114e234c.tar.bz2 askama-e46e2d6b02394eea8ffe7ac723469b9b114e234c.zip |
Handle a lack of whitespace after match block (fixes #76)
Diffstat (limited to '')
-rw-r--r-- | askama_shared/src/generator.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs index bec3437..8a112c8 100644 --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -415,11 +415,13 @@ impl<'a> Generator<'a> { self.writeln("}"); } - fn write_match(&mut self, state: &'a State, ws1: &WS, expr: &Expr, inter: &'a str, arms: - &'a [When], ws2: &WS) { + fn write_match(&mut self, state: &'a State, ws1: &WS, expr: &Expr, inter: Option<&'a str>, + arms: &'a [When], ws2: &WS) { self.flush_ws(ws1); - if !inter.is_empty() { - self.next_ws = Some(inter); + if let Some(inter) = inter { + if !inter.is_empty() { + self.next_ws = Some(inter); + } } self.write("match "); |