]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/borrow_check/used_muts.rs
Use Place directly on remove_never_initialized_mut_locals, it's Copy
[rust.git] / src / librustc_mir / borrow_check / used_muts.rs
index eb1527b874ebec641ddfc6c8fd7d755f06ad7a33..2da72f3bcc517451239ca8ffed3a0134e6593983 100644 (file)
@@ -51,7 +51,7 @@ struct GatherUsedMutsVisitor<'visit, 'cx, 'tcx> {
 }
 
 impl GatherUsedMutsVisitor<'_, '_, '_> {
-    fn remove_never_initialized_mut_locals(&mut self, into: &Place<'_>) {
+    fn remove_never_initialized_mut_locals(&mut self, into: Place<'_>) {
         // Remove any locals that we found were initialized from the
         // `never_initialized_mut_locals` set. At the end, the only remaining locals will
         // be those that were never initialized - we will consider those as being used as
@@ -66,10 +66,10 @@ fn visit_terminator_kind(&mut self, kind: &TerminatorKind<'tcx>, _location: Loca
         debug!("visit_terminator_kind: kind={:?}", kind);
         match &kind {
             TerminatorKind::Call { destination: Some((into, _)), .. } => {
-                self.remove_never_initialized_mut_locals(&into);
+                self.remove_never_initialized_mut_locals(*into);
             }
             TerminatorKind::DropAndReplace { location, .. } => {
-                self.remove_never_initialized_mut_locals(&location);
+                self.remove_never_initialized_mut_locals(*location);
             }
             _ => {}
         }
@@ -82,7 +82,7 @@ fn visit_statement(&mut self, statement: &Statement<'tcx>, _location: Location)
                     never_initialized_mut_locals={:?}",
                 statement, into.local, self.never_initialized_mut_locals
             );
-            self.remove_never_initialized_mut_locals(into);
+            self.remove_never_initialized_mut_locals(*into);
         }
     }