aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src
diff options
context:
space:
mode:
authorLibravatar Christian Vallentin <vallentinsource@gmail.com>2020-12-01 09:25:36 +0100
committerLibravatar GitHub <noreply@github.com>2020-12-01 09:25:36 +0100
commitf4065b09b91f5d00efa5644915cdd83bfb7d393a (patch)
tree8197d60f39068af657ce827120ea35ac467c7b0a /askama_shared/src
parent8603298dc8c8c80d95199e1f42ec6951264322f1 (diff)
downloadaskama-f4065b09b91f5d00efa5644915cdd83bfb7d393a.tar.gz
askama-f4065b09b91f5d00efa5644915cdd83bfb7d393a.tar.bz2
askama-f4065b09b91f5d00efa5644915cdd83bfb7d393a.zip
Fixed implicit borrow of expressions (#390)
Diffstat (limited to '')
-rw-r--r--askama_shared/src/generator.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
index a37ca7c..3a91e3c 100644
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -717,10 +717,11 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
}
names.write(arg);
- values.write("&");
+ values.write("&(");
values.write(&self.visit_expr_root(args.get(i).ok_or_else(|| {
CompileError::String(format!("macro '{}' takes more than {} arguments", name, i))
})?)?);
+ values.write(")");
self.locals.insert(arg);
}
@@ -944,7 +945,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
let expression = match wrapped {
Wrapped => expr_buf.buf,
Unwrapped => format!(
- "::askama::MarkupDisplay::new_unsafe(&{}, {})",
+ "::askama::MarkupDisplay::new_unsafe(&({}), {})",
expr_buf.buf, self.input.escaper
),
};