diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2020-01-12 16:07:35 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2020-01-12 16:07:35 +0100 |
commit | 0f90ab83d68cd8b5fb7ca6ec31b820fd7893cd06 (patch) | |
tree | 8b026222e2e3ebbed8b3fb8baa2e16f83f00398e /askama_derive | |
parent | 5c4896acf46bb4a2737c165f07fb603727d96452 (diff) | |
download | askama-0f90ab83d68cd8b5fb7ca6ec31b820fd7893cd06.tar.gz askama-0f90ab83d68cd8b5fb7ca6ec31b820fd7893cd06.tar.bz2 askama-0f90ab83d68cd8b5fb7ca6ec31b820fd7893cd06.zip |
Improve spacing
Diffstat (limited to 'askama_derive')
-rw-r--r-- | askama_derive/src/generator.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index f1e1174..49e5dda 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -1285,12 +1285,14 @@ where scopes: vec![HashSet::new()], } } + fn with_parent<'p>(parent: &'p SetChain<T>) -> SetChain<'p, T> { SetChain { parent: Some(parent), scopes: vec![HashSet::new()], } } + fn contains(&self, val: T) -> bool { self.scopes.iter().rev().any(|set| set.contains(&val)) || match self.parent { @@ -1298,15 +1300,19 @@ where None => false, } } + fn is_current_empty(&self) -> bool { self.scopes.last().unwrap().is_empty() } + fn insert(&mut self, val: T) { self.scopes.last_mut().unwrap().insert(val); } + fn push(&mut self) { self.scopes.push(HashSet::new()); } + fn pop(&mut self) { self.scopes.pop().unwrap(); assert!(!self.scopes.is_empty()); |