aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-05-25 17:57:55 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-05-25 18:17:12 +0200
commit22a0399cd74e7695d7c44af020c3b24470db2873 (patch)
tree2212a239670a6299a93d1c2256758bf0eef14cc9 /askama_derive/src
parent471b848f612b9210c9ad873443c5f1fc30ab6d76 (diff)
downloadaskama-22a0399cd74e7695d7c44af020c3b24470db2873.tar.gz
askama-22a0399cd74e7695d7c44af020c3b24470db2873.tar.bz2
askama-22a0399cd74e7695d7c44af020c3b24470db2873.zip
Simplify generated code by propagating final expressions
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 8334964..188c521 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -236,11 +236,11 @@ impl<'a> Generator<'a> {
self.handle(state, nodes, AstLevel::Top);
self.flush_ws(&WS(false, false));
self.impl_blocks = false;
+ self.writeln("Ok(())");
} else {
- self.writeln("self._parent.render_trait_into(self, writer)?;");
+ self.writeln("self._parent.render_trait_into(self, writer)");
}
- self.writeln("Ok(())");
self.writeln("}");
self.flush_ws(&WS(false, false));
self.writeln("}");
@@ -252,11 +252,10 @@ impl<'a> Generator<'a> {
self.writeln("fn render_into(&self, writer: &mut ::std::fmt::Write) \
-> ::askama::Result<()> {");
if state.derived {
- self.writeln("self._parent.render_trait_into(self, writer)?;");
+ self.writeln("self._parent.render_trait_into(self, writer)");
} else {
- self.writeln("self.render_trait_into(self, writer)?;");
+ self.writeln("self.render_trait_into(self, writer)");
}
- self.writeln("Ok(())");
self.writeln("}");
self.writeln("}");
}