diff options
author | Tomas <maklins08@gmail.com> | 2018-11-07 10:27:41 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2018-11-07 20:13:11 +0100 |
commit | 471654dd94e862721384a89d61c47697d536648d (patch) | |
tree | f0c405ae0fee65c5a909501f5c714d9d78564d6f /askama_derive | |
parent | 8224f06f3e900443ee42d75cba30d4b9f5f6fd95 (diff) | |
download | askama-471654dd94e862721384a89d61c47697d536648d.tar.gz askama-471654dd94e862721384a89d61c47697d536648d.tar.bz2 askama-471654dd94e862721384a89d61c47697d536648d.zip |
Fix generated code format
Diffstat (limited to 'askama_derive')
-rw-r--r-- | askama_derive/src/generator.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index e0c0efb..f309493 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -627,7 +627,7 @@ impl<'a> Generator<'a> { buf.writeln(&format!("writer.write_str({:#?})?;", &buf_lit.buf)); } else { let mut buf_format = Buffer::new(0); - let mut buf_expr = Buffer::new(0); + let mut buf_expr = Buffer::new(buf.indent + 1); for s in mem::replace(&mut self.buf_writable, vec![]) { match s { Writable::Lit(s) => { @@ -649,16 +649,19 @@ impl<'a> Generator<'a> { format!("::askama::MarkupDisplay::from(&{})", expr_buf.buf) } }); - buf_expr.write(", "); + buf_expr.writeln(","); } } } - buf.write("write!(writer, "); - buf.write(&format!("{:#?}", &buf_format.buf)); - buf.writeln(", "); - buf.write("\t"); + buf.writeln("write!("); + buf.indent(); + buf.writeln("writer,"); + buf.writeln(&format!("{:#?},", &buf_format.buf)); + buf.start = false; buf.write(&buf_expr.buf); + buf.dedent(); + buf.start = true; buf.writeln(")?;"); } } |