aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/generator.rs
diff options
context:
space:
mode:
authorLibravatar Guillaume Gomez <guillaume1.gomez@gmail.com>2023-11-20 10:15:57 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-11-20 10:34:26 +0100
commit70b5b14dc54f13dcc7df6ab685ee24f88bda8123 (patch)
tree037e70708ade15f5eddb3b950e546c8498de971f /askama_derive/src/generator.rs
parent9de2336ab2506222369182b0f13be2165d43011c (diff)
downloadaskama-70b5b14dc54f13dcc7df6ab685ee24f88bda8123.tar.gz
askama-70b5b14dc54f13dcc7df6ab685ee24f88bda8123.tar.bz2
askama-70b5b14dc54f13dcc7df6ab685ee24f88bda8123.zip
Improve macro call arguments loop
Diffstat (limited to 'askama_derive/src/generator.rs')
-rw-r--r--askama_derive/src/generator.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index abd16d5..8f0b7b3 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -727,10 +727,7 @@ impl<'a> Generator<'a> {
args.len()
)));
}
- for (i, arg) in def.args.iter().enumerate() {
- let expr = args.get(i).ok_or_else(|| {
- CompileError::from(format!("macro {name:?} takes more than {i} arguments"))
- })?;
+ for (expr, arg) in std::iter::zip(args, &def.args) {
match expr {
// If `expr` is already a form of variable then
// don't reintroduce a new variable. This is