aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-09-04 20:31:28 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-09-04 20:31:28 +0200
commit9a21f5eaa3920c51371ee5bd0634e148d825dd71 (patch)
tree6f1fe858387a8c48379b3ce10850ea8090d60f8a /askama_shared
parent986535fc958c0d19c10fd6fc5781fe0b2dcdd442 (diff)
downloadaskama-9a21f5eaa3920c51371ee5bd0634e148d825dd71.tar.gz
askama-9a21f5eaa3920c51371ee5bd0634e148d825dd71.tar.bz2
askama-9a21f5eaa3920c51371ee5bd0634e148d825dd71.zip
Tighten up code for join filter handling
Diffstat (limited to 'askama_shared')
-rw-r--r--askama_shared/src/generator.rs9
1 files changed, 1 insertions, 8 deletions
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
index 836da34..4d101a1 100644
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -238,25 +238,18 @@ impl<'a> Generator<'a> {
self.write(")");
}
+ // Force type coercion on first argument to `join` filter (see #39).
fn _visit_join_filter(&mut self, args: &[Expr]) {
- // this is a separate handler because we need to generate code like
- // this to force auto-deref for first argument:
- // `join((&&&&&&self.s).into_iter(), ", ")`
- // otherwise, we were getting errors described in PR #39
self.write("::askama::filters::join((&");
-
for (i, arg) in args.iter().enumerate() {
if i > 0 {
self.write(", &");
}
-
self.visit_expr(arg);
-
if i == 0 {
self.write(").into_iter()");
}
}
-
self.write(")?");
}