From 58e02a4fb6f6d58ff68d18f24abcfc8cab53f7be Mon Sep 17 00:00:00 2001 From: René Kijewski Date: Tue, 24 Jan 2023 09:21:52 +0100 Subject: derive: Make Config `'static` The configuration is made `'static`, because `toml` and `toml_edit` both needs to implement serde's `DeserializeOwned` by now. We allocate the strings once per template, so it is very unlikely that this change will have any measurable impact, neither in compile time nor RAM usage. --- askama_derive/src/input.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'askama_derive/src/input.rs') diff --git a/askama_derive/src/input.rs b/askama_derive/src/input.rs index 47d51bd..b8a0da4 100644 --- a/askama_derive/src/input.rs +++ b/askama_derive/src/input.rs @@ -9,8 +9,8 @@ use mime::Mime; pub(crate) struct TemplateInput<'a> { pub(crate) ast: &'a syn::DeriveInput, - pub(crate) config: &'a Config<'a>, - pub(crate) syntax: &'a Syntax<'a>, + pub(crate) config: &'a Config, + pub(crate) syntax: &'a Syntax, pub(crate) source: Source, pub(crate) print: Print, pub(crate) escaper: &'a str, @@ -25,7 +25,7 @@ impl TemplateInput<'_> { /// `template()` attribute list fields. pub(crate) fn new<'n>( ast: &'n syn::DeriveInput, - config: &'n Config<'_>, + config: &'n Config, args: TemplateArgs, ) -> Result, CompileError> { let TemplateArgs { @@ -51,7 +51,7 @@ impl TemplateInput<'_> { // Validate syntax let syntax = syntax.map_or_else( - || Ok(config.syntaxes.get(config.default_syntax).unwrap()), + || Ok(config.syntaxes.get(&config.default_syntax).unwrap()), |s| { config .syntaxes -- cgit