Skip to content

Commit

Permalink
Revert "Add automatic borrowing to let statement"
Browse files Browse the repository at this point in the history
This reverts commit 3d52283.
  • Loading branch information
GuillaumeGomez authored and djc committed Jan 10, 2024
1 parent 50c64bc commit 1ee067f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
7 changes: 0 additions & 7 deletions askama_derive/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,14 +916,7 @@ impl<'a> Generator<'a> {
};

let mut expr_buf = Buffer::new(0);
let borrow_val = !is_copyable(val);
if borrow_val {
expr_buf.write("&(");
}
self.visit_expr(&mut expr_buf, val)?;
if borrow_val {
expr_buf.write(")");
}

let shadowed = self.is_shadowing_variable(&l.var)?;
if shadowed {
Expand Down
14 changes: 0 additions & 14 deletions testing/tests/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,17 +484,3 @@ fn test_num_literals() {
"[90, -90, 90, 2, 56, 240, 10.5, 10.5, 100000000000, 105000000000]",
);
}

#[derive(askama::Template)]
#[template(source = "{% let word = s %}{{ word }}", ext = "html")]
struct LetBorrow {
s: String,
}

#[test]
fn test_let_borrow() {
let template = LetBorrow {
s: "hello".to_owned(),
};
assert_eq!(template.render().unwrap(), "hello")
}

0 comments on commit 1ee067f

Please sign in to comment.