Unreachable subpatterns are rare

We may as well leave early when we know there's nothing to report.
This commit is contained in:
Nadrieril 2020-11-07 23:45:36 +00:00
parent b025813f03
commit d5a7ec0929

View File

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