From 70b5b14dc54f13dcc7df6ab685ee24f88bda8123 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 20 Nov 2023 10:15:57 +0100 Subject: Improve macro call arguments loop --- askama_derive/src/generator.rs | 5 +---- 1 file changed, 1 insertion(+), 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 -- cgit