diff options
Diffstat (limited to 'askama_derive/src/generator.rs')
-rw-r--r-- | askama_derive/src/generator.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index b6b5146..2a233d5 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -404,7 +404,10 @@ impl<'a> Generator<'a> { self.locals.insert(name); buf.write(name); } - buf.writeln(&format!(") in (&{}).into_iter().enumerate() {{", expr_code)); + match iter { + Expr::Range(_, _, _) => buf.writeln(&format!(") in ({}).enumerate() {{", expr_code)), + _ => buf.writeln(&format!(") in (&{}).into_iter().enumerate() {{", expr_code)), + }; self.handle(ctx, body, buf, AstLevel::Nested); self.handle_ws(buf, ws2); |