Rollup merge of #76890 - matthiaskrgr:matches_simpl, r=lcnr

use matches!() macro for simple if let conditions
This commit is contained in:
Ralf Jung
2020-09-20 15:52:01 +02:00
committed by GitHub
15 changed files with 33 additions and 36 deletions

View File

@@ -92,7 +92,7 @@ pub enum TempState {
impl TempState {
pub fn is_promotable(&self) -> bool {
debug!("is_promotable: self={:?}", self);
if let TempState::Defined { .. } = *self { true } else { false }
matches!(self, TempState::Defined { .. } )
}
}

View File

@@ -281,8 +281,7 @@ impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> {
fn strip_nops(&mut self) {
for blk in self.basic_blocks.iter_mut() {
blk.statements
.retain(|stmt| if let StatementKind::Nop = stmt.kind { false } else { true })
blk.statements.retain(|stmt| !matches!(stmt.kind, StatementKind::Nop))
}
}
}