diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2021-03-29 22:37:59 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2021-03-30 09:59:12 +0200 |
commit | c0e01318ac851641a266584ef6f24f4c61c0f006 (patch) | |
tree | b4aacd4b9a3dc0c153c685e7ddad27e7706cf249 | |
parent | 46792fe8434f98ca6d03c32978a3f89d196c745d (diff) | |
download | askama-c0e01318ac851641a266584ef6f24f4c61c0f006.tar.gz askama-c0e01318ac851641a266584ef6f24f4c61c0f006.tar.bz2 askama-c0e01318ac851641a266584ef6f24f4c61c0f006.zip |
Use mem::take() where applicable
-rw-r--r-- | askama_shared/src/generator.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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("}", "}}")); |