diff options
author | vallentin <mail@vallentin.dev> | 2021-02-23 08:48:37 +0100 |
---|---|---|
committer | Christian Vallentin <vallentinsource@gmail.com> | 2021-02-23 09:51:27 +0100 |
commit | 5a799af0900882414b2cf5e642e88a3e36845400 (patch) | |
tree | 6f0c5f7523aceb18e1480196304c728444754ace /askama_shared/src/generator.rs | |
parent | bfeaf5d6d8c1be478971c428734775cb9ef950c2 (diff) | |
download | askama-5a799af0900882414b2cf5e642e88a3e36845400.tar.gz askama-5a799af0900882414b2cf5e642e88a3e36845400.tar.bz2 askama-5a799af0900882414b2cf5e642e88a3e36845400.zip |
Reworked constants to be parsed as paths
Diffstat (limited to '')
-rw-r--r-- | askama_shared/src/generator.rs | 7 |
1 files changed, 2 insertions, 5 deletions
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)) } } |