Rollup merge of #48727 - leodasvacas:refactor-contrived-match, r=rkruppe

Refactor contrived match.
This commit is contained in:
kennytm 2018-03-06 16:25:38 +08:00
commit 57cfbeaf64
No known key found for this signature in database
GPG Key ID: FEF6C8051D0E013C

View File

@ -77,19 +77,12 @@ impl Lower128Bit {
};
let bin_statement = block.statements.pop().unwrap();
let (source_info, place, lhs, mut rhs) = match bin_statement {
Statement {
source_info,
kind: StatementKind::Assign(
place,
Rvalue::BinaryOp(_, lhs, rhs))
} => (source_info, place, lhs, rhs),
Statement {
source_info,
kind: StatementKind::Assign(
place,
Rvalue::CheckedBinaryOp(_, lhs, rhs))
} => (source_info, place, lhs, rhs),
let source_info = bin_statement.source_info;
let (place, lhs, mut rhs) = match bin_statement.kind {
StatementKind::Assign(place, Rvalue::BinaryOp(_, lhs, rhs))
| StatementKind::Assign(place, Rvalue::CheckedBinaryOp(_, lhs, rhs)) => {
(place, lhs, rhs)
}
_ => bug!("Statement doesn't match pattern any more?"),
};