diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2020-09-18 19:11:06 +0200 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2020-09-18 20:28:35 +0200 |
| commit | 40dddd33059344b546a11f150c0ec63e797f021c (patch) | |
| tree | 309de3a572ac13deab5afa9b4a1ff39726b75901 /compiler/rustc_mir/src | |
| parent | 2c69266c0697b0c0b34abea62cba1a1d3c59c90c (diff) | |
| download | rust-40dddd33059344b546a11f150c0ec63e797f021c.tar.gz rust-40dddd33059344b546a11f150c0ec63e797f021c.zip | |
use matches!() macro for simple if let conditions
Diffstat (limited to 'compiler/rustc_mir/src')
| -rw-r--r-- | compiler/rustc_mir/src/borrow_check/diagnostics/outlives_suggestion.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_mir/src/transform/promote_consts.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_mir/src/transform/simplify.rs | 3 |
3 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_mir/src/borrow_check/diagnostics/outlives_suggestion.rs b/compiler/rustc_mir/src/borrow_check/diagnostics/outlives_suggestion.rs index a775fa59c1b..7505e6e2dd1 100644 --- a/compiler/rustc_mir/src/borrow_check/diagnostics/outlives_suggestion.rs +++ b/compiler/rustc_mir/src/borrow_check/diagnostics/outlives_suggestion.rs @@ -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 diff --git a/compiler/rustc_mir/src/transform/promote_consts.rs b/compiler/rustc_mir/src/transform/promote_consts.rs index 1d2295a37dd..75efed043ce 100644 --- a/compiler/rustc_mir/src/transform/promote_consts.rs +++ b/compiler/rustc_mir/src/transform/promote_consts.rs @@ -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 { .. } ) } } diff --git a/compiler/rustc_mir/src/transform/simplify.rs b/compiler/rustc_mir/src/transform/simplify.rs index d8995e92abf..3fc8e6d4b04 100644 --- a/compiler/rustc_mir/src/transform/simplify.rs +++ b/compiler/rustc_mir/src/transform/simplify.rs @@ -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)) } } } |
