From c0e01318ac851641a266584ef6f24f4c61c0f006 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 29 Mar 2021 22:37:59 +0200 Subject: Use mem::take() where applicable --- askama_shared/src/generator.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'askama_shared') diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs index f8e2d8f..3ce2f2d 100644 --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -971,7 +971,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { .all(|w| matches!(w, Writable::Lit(_))) { let mut buf_lit = Buffer::new(0); - for s in mem::replace(&mut self.buf_writable, vec![]) { + for s in mem::take(&mut self.buf_writable) { if let Writable::Lit(s) = s { buf_lit.write(s); }; @@ -984,7 +984,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { let mut buf_format = Buffer::new(0); let mut buf_expr = Buffer::new(buf.indent + 1); let mut expr_cache = HashMap::with_capacity(self.buf_writable.len()); - for s in mem::replace(&mut self.buf_writable, vec![]) { + for s in mem::take(&mut self.buf_writable) { match s { Writable::Lit(s) => { buf_format.write(&s.replace("{", "{{").replace("}", "}}")); -- cgit