From 82a406df795e2645c83d9ec0974f1f0421337d9b Mon Sep 17 00:00:00 2001 From: Yusuke Sasaki Date: Sun, 4 Nov 2018 18:04:28 +0900 Subject: use UFCS in derived code --- askama_derive/src/generator.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'askama_derive') 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 -- cgit