Skip to content

Commit

Permalink
Rollup merge of #85278 - ayushmishra2005:code-refactoring, r=jackh726
Browse files Browse the repository at this point in the history
Improve match statements
  • Loading branch information
GuillaumeGomez committed May 15, 2021
2 parents 1a926bf + 27defcd commit cd3d166
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions compiler/rustc_mir/src/transform/early_otherwise_branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_mir/src/transform/simplify_try.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit cd3d166

Please sign in to comment.