From 0f90ab83d68cd8b5fb7ca6ec31b820fd7893cd06 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sun, 12 Jan 2020 16:07:35 +0100 Subject: Improve spacing --- askama_derive/src/generator.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'askama_derive/src') 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) -> 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()); -- cgit