From 22a0399cd74e7695d7c44af020c3b24470db2873 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 25 May 2018 17:57:55 +0200 Subject: Simplify generated code by propagating final expressions --- askama_derive/src/generator.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'askama_derive/src') 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("}"); } -- cgit