diff options
author | Yusuke Sasaki <yusuke.sasaki.nuem@gmail.com> | 2018-11-04 18:04:28 +0900 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2018-11-04 22:14:11 +0100 |
commit | 82a406df795e2645c83d9ec0974f1f0421337d9b (patch) | |
tree | c42d240e54dc9fd66b6a55034fad72d3d4a91c62 /askama_derive | |
parent | efe621195e3e2459275e4985659c8b0158d0b880 (diff) | |
download | askama-82a406df795e2645c83d9ec0974f1f0421337d9b.tar.gz askama-82a406df795e2645c83d9ec0974f1f0421337d9b.tar.bz2 askama-82a406df795e2645c83d9ec0974f1f0421337d9b.zip |
use UFCS in derived code
Diffstat (limited to 'askama_derive')
-rw-r--r-- | askama_derive/src/generator.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 0395c11..e0c0efb 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -137,7 +137,7 @@ impl<'a> Generator<'a> { fn impl_display(&mut self, buf: &mut Buffer) { self.write_header(buf, "::std::fmt::Display", None); buf.writeln("fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {"); - buf.writeln("self.render_into(f).map_err(|_| ::std::fmt::Error {})"); + buf.writeln("::askama::Template::render_into(self, f).map_err(|_| ::std::fmt::Error {})"); buf.writeln("}"); buf.writeln("}"); } @@ -150,7 +150,9 @@ impl<'a> Generator<'a> { None, ); buf.writeln("fn modify(self, res: &mut ::askama::iron::Response) {"); - buf.writeln("res.body = Some(Box::new(self.render().unwrap().into_bytes()));"); + buf.writeln( + "res.body = Some(Box::new(::askama::Template::render(&self).unwrap().into_bytes()));", + ); let ext = self .input |