diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-10-10 15:17:36 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-11-01 12:52:09 +0100 |
commit | daa404713e8e1e5294a3cf65040172d33e43a0eb (patch) | |
tree | 9675014cc1e40fad7963e04d3ad3040293affc40 /askama_derive/src/generator.rs | |
parent | babea28312387a22642cb974cc4b97e9fe7fed49 (diff) | |
download | askama-daa404713e8e1e5294a3cf65040172d33e43a0eb.tar.gz askama-daa404713e8e1e5294a3cf65040172d33e43a0eb.tar.bz2 askama-daa404713e8e1e5294a3cf65040172d33e43a0eb.zip |
Avoid passing around duplicate data
Diffstat (limited to '')
-rw-r--r-- | askama_derive/src/generator.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 929e18c..9031e8b 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -37,9 +37,6 @@ pub(crate) struct Generator<'a> { buf_writable: Vec<Writable<'a>>, // Counter for write! hash named arguments named: usize, - // If set to `suppress`, the whitespace characters will be removed by default unless `+` is - // used. - whitespace: WhitespaceHandling, } impl<'a> Generator<'a> { @@ -48,7 +45,6 @@ impl<'a> Generator<'a> { contexts: &'n HashMap<&'n Path, Context<'n>>, heritage: Option<&'n Heritage<'_>>, locals: MapChain<'n, &'n str, LocalMeta>, - whitespace: WhitespaceHandling, ) -> Generator<'n> { Generator { input, @@ -61,7 +57,6 @@ impl<'a> Generator<'a> { super_block: None, buf_writable: vec![], named: 0, - whitespace, } } @@ -796,13 +791,7 @@ impl<'a> Generator<'a> { // handle the include's nodes. Unfortunately we can't easily share the `includes` cache. let locals = MapChain::with_parent(&self.locals); - let mut child = Self::new( - self.input, - self.contexts, - self.heritage, - locals, - self.whitespace, - ); + let mut child = Self::new(self.input, self.contexts, self.heritage, locals); let nodes = match self.contexts.get(path.as_path()) { Some(ctx) => ctx.nodes, @@ -1638,7 +1627,7 @@ impl<'a> Generator<'a> { Some(Whitespace::Suppress) => WhitespaceHandling::Suppress, Some(Whitespace::Preserve) => WhitespaceHandling::Preserve, Some(Whitespace::Minimize) => WhitespaceHandling::Minimize, - None => self.whitespace, + None => self.input.config.whitespace, } } |