From 1f11e7133de188bc5a83ff4b8462c69cf1c19174 Mon Sep 17 00:00:00 2001 From: Yusuke Sasaki Date: Thu, 11 Oct 2018 03:14:27 +0900 Subject: make `Template::extension()` static It is useful for calculating the media type without instantiating the context value. --- askama_derive/src/generator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'askama_derive/src') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 2c9fddb..4f83b07 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -107,7 +107,7 @@ impl<'a> Generator<'a> { buf.writeln("Ok(())"); buf.writeln("}"); - buf.writeln("fn extension(&self) -> Option<&str> {"); + buf.writeln("fn extension() -> Option<&'static str> {"); buf.writeln(&format!( "{:?}", self.input.path.extension().map(|s| s.to_str().unwrap()) -- cgit