]> git.lizzy.rs Git - rust.git/commitdiff
Move debug statement into statement visitor
authorChris Gregory <czipperz@gmail.com>
Sun, 2 Jun 2019 00:05:18 +0000 (19:05 -0500)
committerChris Gregory <czipperz@gmail.com>
Sun, 2 Jun 2019 00:05:18 +0000 (19:05 -0500)
src/librustc_mir/borrow_check/used_muts.rs

index 828429a1808c337b9162079f88268806c0edcd30..b9accd40c399887809d903bb44a406de16f8168d 100644 (file)
@@ -60,11 +60,6 @@ fn remove_never_initialized_mut_locals(&mut self, into: &Place) {
         // they will either have been removed by unreachable code optimizations; or linted
         // as unused variables.
         if let Some(local) = into.base_local() {
-            debug!(
-                "visit_statement: statement={:?} local={:?} \
-                 never_initialized_mut_locals={:?}",
-                statement, local, self.never_initialized_mut_locals
-            );
             let _ = self.never_initialized_mut_locals.remove(&local);
         }
     }
@@ -95,6 +90,13 @@ fn visit_statement(
     ) {
         match &statement.kind {
             StatementKind::Assign(into, _) => {
+                if let Some(local) = into.base_local() {
+                    debug!(
+                        "visit_statement: statement={:?} local={:?} \
+                         never_initialized_mut_locals={:?}",
+                        statement, local, self.never_initialized_mut_locals
+                    );
+                }
                 self.remove_never_initialized_mut_locals(into);
             },
             _ => {},