Move debug statement into statement visitor

This commit is contained in:
Chris Gregory 2019-06-01 19:05:18 -05:00
parent a39fffea22
commit 0a6a5c81ac

View File

@ -60,11 +60,6 @@ impl GatherUsedMutsVisitor<'_, '_, '_, '_> {
// 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 @@ impl<'visit, 'cx, 'gcx, 'tcx> Visitor<'tcx> for GatherUsedMutsVisitor<'visit, 'c
) {
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);
},
_ => {},