Skip to content

Commit d5a7ec0

Browse files
committed
Unreachable subpatterns are rare
We may as well leave early when we know there's nothing to report.
1 parent b025813 commit d5a7ec0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: compiler/rustc_mir_build/src/thir/pattern/check_match.rs

+2
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ fn check_arms<'p, 'tcx>(
389389
hir::MatchSource::AwaitDesugar | hir::MatchSource::TryDesugar => {}
390390
}
391391
}
392+
Useful(unreachables) if unreachables.is_empty() => {}
393+
// The arm is reachable, but contains unreachable subpatterns (from or-patterns).
392394
Useful(unreachables) => {
393395
let mut unreachables: Vec<_> = unreachables.into_iter().flatten().collect();
394396
// Emit lints in the order in which they occur in the file.

0 commit comments

Comments
 (0)