use matches!() macro for simple if let conditions
This commit is contained in:
parent
2c69266c06
commit
40dddd3305
15 changed files with 33 additions and 36 deletions
|
@ -115,9 +115,10 @@ impl OutlivesSuggestionBuilder {
|
|||
// should just replace 'a with 'static.
|
||||
// 3) Suggest unifying 'a with 'b if we have both 'a: 'b and 'b: 'a
|
||||
|
||||
if outlived.iter().any(|(_, outlived_name)| {
|
||||
if let RegionNameSource::Static = outlived_name.source { true } else { false }
|
||||
}) {
|
||||
if outlived
|
||||
.iter()
|
||||
.any(|(_, outlived_name)| matches!(outlived_name.source, RegionNameSource::Static))
|
||||
{
|
||||
suggested.push(SuggestedConstraint::Static(fr_name));
|
||||
} else {
|
||||
// We want to isolate out all lifetimes that should be unified and print out
|
||||
|
|
|
@ -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 { .. } )
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue