From ea8be4421d73a9ef056c05889d87062dfb5a69c8 Mon Sep 17 00:00:00 2001 From: René Kijewski Date: Thu, 6 Jan 2022 14:43:01 +0100 Subject: Remove ext argument in integrations --- askama_derive/src/generator.rs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'askama_derive/src/generator.rs') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 7077cfd..b57a6f6 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -407,8 +407,7 @@ impl<'a> Generator<'a> { "fn into_response(self)\ -> ::askama_axum::Response {", )?; - let ext = self.input.extension().unwrap_or("txt"); - buf.writeln(&format!("::askama_axum::into_response(&self, {:?})", ext))?; + buf.writeln("::askama_axum::into_response(&self)")?; buf.writeln("}")?; buf.writeln("}") } @@ -422,8 +421,7 @@ impl<'a> Generator<'a> { "fn into_response(self, _state: &::askama_gotham::State)\ -> ::askama_gotham::Response<::askama_gotham::Body> {", )?; - let ext = self.input.extension().unwrap_or("txt"); - buf.writeln(&format!("::askama_gotham::respond(&self, {:?})", ext))?; + buf.writeln("::askama_gotham::respond(&self)")?; buf.writeln("}")?; buf.writeln("}") } @@ -494,10 +492,7 @@ impl<'a> Generator<'a> { -> ::mendes::http::Response {", )?; - buf.writeln(&format!( - "::askama_mendes::into_response(app, req, &self, {:?})", - self.input.extension() - ))?; + buf.writeln("::askama_mendes::into_response(app, req, &self)")?; buf.writeln("}")?; buf.writeln("}")?; Ok(()) @@ -519,8 +514,7 @@ impl<'a> Generator<'a> { "fn respond_to(self, _: &::askama_rocket::Request) \ -> ::askama_rocket::Result<'askama> {", )?; - let ext = self.input.extension().unwrap_or("txt"); - buf.writeln(&format!("::askama_rocket::respond(&self, {:?})", ext))?; + buf.writeln("::askama_rocket::respond(&self)")?; buf.writeln("}")?; buf.writeln("}")?; @@ -529,8 +523,6 @@ impl<'a> Generator<'a> { #[cfg(feature = "with-tide")] fn impl_tide_integrations(&mut self, buf: &mut Buffer) -> Result<(), CompileError> { - let ext = self.input.extension().unwrap_or("txt"); - self.write_header( buf, "::std::convert::TryInto<::askama_tide::tide::Body>", @@ -541,7 +533,7 @@ impl<'a> Generator<'a> { #[inline]\n\ fn try_into(self) -> ::askama_tide::askama::Result<::askama_tide::tide::Body> {", )?; - buf.writeln(&format!("::askama_tide::try_into_body(&self, {:?})", &ext))?; + buf.writeln("::askama_tide::try_into_body(&self)")?; buf.writeln("}")?; buf.writeln("}")?; @@ -549,7 +541,7 @@ impl<'a> Generator<'a> { self.write_header(buf, "Into<::askama_tide::tide::Response>", None)?; buf.writeln("#[inline]")?; buf.writeln("fn into(self) -> ::askama_tide::tide::Response {")?; - buf.writeln(&format!("::askama_tide::into_response(&self, {:?})", ext))?; + buf.writeln("::askama_tide::into_response(&self)")?; buf.writeln("}\n}") } @@ -558,8 +550,7 @@ impl<'a> Generator<'a> { self.write_header(buf, "::askama_warp::warp::reply::Reply", None)?; buf.writeln("#[inline]")?; buf.writeln("fn into_response(self) -> ::askama_warp::warp::reply::Response {")?; - let ext = self.input.extension().unwrap_or("txt"); - buf.writeln(&format!("::askama_warp::reply(&self, {:?})", ext))?; + buf.writeln("::askama_warp::reply(&self)")?; buf.writeln("}")?; buf.writeln("}") } -- cgit