about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-07-04 01:38:46 +0200
committerGitHub <noreply@github.com>2019-07-04 01:38:46 +0200
commit88c007cd0418e92bbacb8a46d9f9b23422da0d56 (patch)
treef0b6b549f2d818d2e12a6b38eebe6c74e026d536 /src/libsyntax/parse
parent6cfd474e3337934da9606844e6cf571f96d9652b (diff)
parenteddfad31400b9c6cba6eda95cadd96c455504898 (diff)
downloadrust-88c007cd0418e92bbacb8a46d9f9b23422da0d56.tar.gz
rust-88c007cd0418e92bbacb8a46d9f9b23422da0d56.zip
Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, r=dtolnay,Centril
Use mem::take instead of mem::replace with default
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 696b5f48385..8ac20f33908 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -7699,7 +7699,7 @@ impl<'a> Parser<'a> {
         let mut tokens = Vec::new();
         let prev_collecting = match self.token_cursor.frame.last_token {
             LastToken::Collecting(ref mut list) => {
-                Some(mem::replace(list, Vec::new()))
+                Some(mem::take(list))
             }
             LastToken::Was(ref mut last) => {
                 tokens.extend(last.take());
@@ -7717,7 +7717,7 @@ impl<'a> Parser<'a> {
 
         // Pull out the tokens that we've collected from the call to `f` above.
         let mut collected_tokens = match *last_token {
-            LastToken::Collecting(ref mut v) => mem::replace(v, Vec::new()),
+            LastToken::Collecting(ref mut v) => mem::take(v),
             LastToken::Was(_) => panic!("our vector went away?"),
         };