about summary refs log tree commit diff
path: root/src/librustc_parse/parser/expr.rs
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2020-04-17 13:59:14 -0700
committerJosh Stone <jistone@redhat.com>2020-04-17 13:59:14 -0700
commitccecae5fdd27fa7695fd45c98ff755029a750eb7 (patch)
tree805b8f0ac90ac90ac76588663dbf98dc7bd0d689 /src/librustc_parse/parser/expr.rs
parent7c4ca59f4b10d20f0f3e902f847641311abb093c (diff)
downloadrust-ccecae5fdd27fa7695fd45c98ff755029a750eb7.tar.gz
rust-ccecae5fdd27fa7695fd45c98ff755029a750eb7.zip
Fix unused results from mem::replace
Diffstat (limited to 'src/librustc_parse/parser/expr.rs')
-rw-r--r--src/librustc_parse/parser/expr.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs
index 4e3c5fa63de..a04a1b220fe 100644
--- a/src/librustc_parse/parser/expr.rs
+++ b/src/librustc_parse/parser/expr.rs
@@ -547,8 +547,7 @@ impl<'a> Parser<'a> {
                 // Rewind to before attempting to parse the type with generics, to recover
                 // from situations like `x as usize < y` in which we first tried to parse
                 // `usize < y` as a type with generic arguments.
-                let parser_snapshot_after_type = self.clone();
-                mem::replace(self, parser_snapshot_before_type);
+                let parser_snapshot_after_type = mem::replace(self, parser_snapshot_before_type);
 
                 match self.parse_path(PathStyle::Expr) {
                     Ok(path) => {
@@ -560,7 +559,7 @@ impl<'a> Parser<'a> {
                                 // example because `parse_ty_no_plus` returns `Err` on keywords,
                                 // but `parse_path` returns `Ok` on them due to error recovery.
                                 // Return original error and parser state.
-                                mem::replace(self, parser_snapshot_after_type);
+                                *self = parser_snapshot_after_type;
                                 return Err(type_err);
                             }
                         };
@@ -601,7 +600,7 @@ impl<'a> Parser<'a> {
                     Err(mut path_err) => {
                         // Couldn't parse as a path, return original error and parser state.
                         path_err.cancel();
-                        mem::replace(self, parser_snapshot_after_type);
+                        *self = parser_snapshot_after_type;
                         return Err(type_err);
                     }
                 }