Fix write expression wrapper
@@ -646,23 +646,20 @@ impl<'a> Generator<'a> {
let wrapped = self.visit_expr(&mut expr_buf, s);
let expression = match (wrapped, &self.input.escaping) {
(Wrapped, &Html) | (Wrapped, &None) | (Unwrapped, &None) => {
- expr_buf.buf.clone()
+ expr_buf.buf
}
(Unwrapped, &Html) => {
- format!(
- "::askama::MarkupDisplay::from(&{})",
- expr_buf.buf.clone()
- )
+ format!("::askama::MarkupDisplay::from(&{})", expr_buf.buf)
}
};
- let id = expr_cache.entry(expression).or_insert_with(|| {
+ let id = expr_cache.entry(expression.clone()).or_insert_with(|| {
let id = self.named;
self.named += 1;
buf_expr.write(&format!("expr{} = ", id));
buf_expr.write("&");
- buf_expr.write(&expr_buf.buf);
+ buf_expr.write(&expression);
buf_expr.writeln(",");
id
