Skip to content

Commit 54f9a44

Browse files
committed
Fix performance issue in liveness checking
1 parent d940e56 commit 54f9a44

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

compiler/rustc_mir_transform/src/liveness.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,11 +1086,6 @@ impl<'a, 'tcx> AssignmentResult<'a, 'tcx> {
10861086

10871087
let Some((name, decl_span)) = self.checked_places.names[index] else { continue };
10881088

1089-
// By convention, underscore-prefixed bindings are explicitly allowed to be unused.
1090-
if name.as_str().starts_with('_') {
1091-
continue;
1092-
}
1093-
10941089
let is_maybe_drop_guard = maybe_drop_guard(
10951090
tcx,
10961091
self.typing_env,
@@ -1118,6 +1113,11 @@ impl<'a, 'tcx> AssignmentResult<'a, 'tcx> {
11181113
continue;
11191114
};
11201115

1116+
// By convention, underscore-prefixed bindings are explicitly allowed to be unused.
1117+
if name.as_str().starts_with('_') {
1118+
continue;
1119+
}
1120+
11211121
match kind {
11221122
AccessKind::Assign => {
11231123
let suggestion = annotate_mut_binding_to_immutable_binding(

0 commit comments

Comments
 (0)