From f4065b09b91f5d00efa5644915cdd83bfb7d393a Mon Sep 17 00:00:00 2001 From: Christian Vallentin Date: Tue, 1 Dec 2020 09:25:36 +0100 Subject: Fixed implicit borrow of expressions (#390) --- askama_shared/src/generator.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'askama_shared') 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 ), }; -- cgit