aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/generator.rs
diff options
context:
space:
mode:
authorLibravatar René Kijewski <rene.kijewski@fu-berlin.de>2023-08-01 03:45:32 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-08-01 13:04:41 +0200
commit7b7c38b37785b83ce28f1cc5f6e89abb89672276 (patch)
treea16abd0f5e877184837adc032db0d3e0cf66b978 /askama_derive/src/generator.rs
parent26f598c0d189769952b11ea9fe6168718f403590 (diff)
downloadaskama-7b7c38b37785b83ce28f1cc5f6e89abb89672276.tar.gz
askama-7b7c38b37785b83ce28f1cc5f6e89abb89672276.tar.bz2
askama-7b7c38b37785b83ce28f1cc5f6e89abb89672276.zip
parser: add type for `Node::Lit`
Diffstat (limited to 'askama_derive/src/generator.rs')
-rw-r--r--askama_derive/src/generator.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index beb3c49..5711c36 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -2,7 +2,7 @@ use crate::config::{get_template_source, read_config_file, Config, WhitespaceHan
use crate::heritage::{Context, Heritage};
use crate::input::{Print, Source, TemplateInput};
use crate::CompileError;
-use parser::{Call, Cond, CondTest, Expr, Loop, Match, Node, Parsed, Target, Whitespace, Ws};
+use parser::{Call, Cond, CondTest, Expr, Lit, Loop, Match, Node, Parsed, Target, Whitespace, Ws};
use proc_macro::TokenStream;
use quote::{quote, ToTokens};
@@ -626,8 +626,8 @@ impl<'a> Generator<'a> {
let mut size_hint = 0;
for n in nodes {
match *n {
- Node::Lit(lws, val, rws) => {
- self.visit_lit(lws, val, rws);
+ Node::Lit(ref lit) => {
+ self.visit_lit(lit);
}
Node::Comment(ws) => {
self.write_comment(ws);
@@ -666,9 +666,9 @@ impl<'a> Generator<'a> {
self.flush_ws(m.ws1);
self.prepare_ws(m.ws2);
}
- Node::Raw(ws1, lws, val, rws, ws2) => {
+ Node::Raw(ws1, ref lit, ws2) => {
self.handle_ws(ws1);
- self.visit_lit(lws, val, rws);
+ self.visit_lit(lit);
self.handle_ws(ws2);
}
Node::Import(ref i) => {
@@ -1274,8 +1274,9 @@ impl<'a> Generator<'a> {
Ok(size_hint)
}
- fn visit_lit(&mut self, lws: &'a str, val: &'a str, rws: &'a str) {
+ fn visit_lit(&mut self, lit: &'a Lit<'_>) {
assert!(self.next_ws.is_none());
+ let Lit { lws, val, rws } = *lit;
if !lws.is_empty() {
match self.skip_ws {
WhitespaceHandling::Suppress => {}