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 | |
parent | 5c4896acf46bb4a2737c165f07fb603727d96452 (diff) | |
download | askama-0f90ab83d68cd8b5fb7ca6ec31b820fd7893cd06.tar.gz askama-0f90ab83d68cd8b5fb7ca6ec31b820fd7893cd06.tar.bz2 askama-0f90ab83d68cd8b5fb7ca6ec31b820fd7893cd06.zip |
Improve spacing
-rw-r--r-- | askama_derive/src/generator.rs | 6 | ||||
-rw-r--r-- | testing/tests/inheritance.rs | 2 |
2 files changed, 7 insertions, 1 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()); diff --git a/testing/tests/inheritance.rs b/testing/tests/inheritance.rs index c007dce..2dac362 100644 --- a/testing/tests/inheritance.rs +++ b/testing/tests/inheritance.rs @@ -303,4 +303,4 @@ struct LetChild {} fn test_let_block() { let t = LetChild {}; assert_eq!(t.render().unwrap(), "1"); -}
\ No newline at end of file +} |