Rollup merge of #85278 - ayushmishra2005:code-refactoring, r=jackh726

Improve match statements
This commit is contained in:
Guillaume Gomez 2021-05-15 13:29:55 +02:00 committed by GitHub
commit cd3d166021
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 8 deletions

View file

@ -170,10 +170,7 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
}
fn is_switch<'tcx>(terminator: &Terminator<'tcx>) -> bool {
match terminator.kind {
TerminatorKind::SwitchInt { .. } => true,
_ => false,
}
matches!(terminator.kind, TerminatorKind::SwitchInt { .. })
}
struct Helper<'a, 'tcx> {

View file

@ -628,10 +628,7 @@ impl<'a, 'tcx> SimplifyBranchSameOptimizationFinder<'a, 'tcx> {
// But `asm!(...)` could abort the program,
// so we cannot assume that the `unreachable` terminator itself is reachable.
// FIXME(Centril): use a normalization pass instead of a check.
|| bb.statements.iter().any(|stmt| match stmt.kind {
StatementKind::LlvmInlineAsm(..) => true,
_ => false,
})
|| bb.statements.iter().any(|stmt| matches!(stmt.kind, StatementKind::LlvmInlineAsm(..)))
})
.peekable();