Rollup merge of #85278 - ayushmishra2005:code-refactoring, r=jackh726
Improve match statements
This commit is contained in:
commit
cd3d166021
2 changed files with 2 additions and 8 deletions
|
@ -170,10 +170,7 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_switch<'tcx>(terminator: &Terminator<'tcx>) -> bool {
|
fn is_switch<'tcx>(terminator: &Terminator<'tcx>) -> bool {
|
||||||
match terminator.kind {
|
matches!(terminator.kind, TerminatorKind::SwitchInt { .. })
|
||||||
TerminatorKind::SwitchInt { .. } => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Helper<'a, 'tcx> {
|
struct Helper<'a, 'tcx> {
|
||||||
|
|
|
@ -628,10 +628,7 @@ impl<'a, 'tcx> SimplifyBranchSameOptimizationFinder<'a, 'tcx> {
|
||||||
// But `asm!(...)` could abort the program,
|
// But `asm!(...)` could abort the program,
|
||||||
// so we cannot assume that the `unreachable` terminator itself is reachable.
|
// so we cannot assume that the `unreachable` terminator itself is reachable.
|
||||||
// FIXME(Centril): use a normalization pass instead of a check.
|
// FIXME(Centril): use a normalization pass instead of a check.
|
||||||
|| bb.statements.iter().any(|stmt| match stmt.kind {
|
|| bb.statements.iter().any(|stmt| matches!(stmt.kind, StatementKind::LlvmInlineAsm(..)))
|
||||||
StatementKind::LlvmInlineAsm(..) => true,
|
|
||||||
_ => false,
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.peekable();
|
.peekable();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue