From 5a799af0900882414b2cf5e642e88a3e36845400 Mon Sep 17 00:00:00 2001 From: vallentin Date: Tue, 23 Feb 2021 08:48:37 +0100 Subject: Reworked constants to be parsed as paths --- askama_shared/src/generator.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'askama_shared/src/generator.rs') diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs index e74de14..b4363a8 100644 --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -1723,11 +1723,8 @@ impl MapChain<'_, &str, LocalMeta> { } fn resolve_or_self(&self, name: &str) -> String { - match self.resolve(name) { - Some(name) => name, - None if name.chars().any(char::is_uppercase) => name.to_string(), - None => format!("self.{}", name), - } + self.resolve(name) + .unwrap_or_else(|| format!("self.{}", name)) } } -- cgit