Also fix if in else

This commit is contained in:
Michael Goulet
2024-09-11 17:23:56 -04:00
parent 954419aab0
commit af8d911d63
27 changed files with 223 additions and 291 deletions

View File

@@ -1500,15 +1500,13 @@ impl<'tcx> Liveness<'_, 'tcx> {
);
}
}
} else {
if let Some(name) = self.should_warn(var) {
self.ir.tcx.emit_node_span_lint(
lint::builtin::UNUSED_VARIABLES,
var_hir_id,
vec![span],
errors::UnusedVarMaybeCaptureRef { name },
);
}
} else if let Some(name) = self.should_warn(var) {
self.ir.tcx.emit_node_span_lint(
lint::builtin::UNUSED_VARIABLES,
var_hir_id,
vec![span],
errors::UnusedVarMaybeCaptureRef { name },
);
}
}
}