diff options
| author | est31 <MTest31@outlook.com> | 2022-02-19 00:48:49 +0100 | 
|---|---|---|
| committer | est31 <MTest31@outlook.com> | 2022-02-19 17:27:43 +0100 | 
| commit | 2ef8af66196f7cc270a0532ea989f2fc6bc6885d (patch) | |
| tree | e023e65e895d79575848f47b3d00129f9c5a9f0f /compiler/rustc_mir_dataflow/src/impls/mod.rs | |
| parent | b8c56fa8c30821129b0960180f528d4a1a4f9316 (diff) | |
| download | rust-2ef8af66196f7cc270a0532ea989f2fc6bc6885d.tar.gz rust-2ef8af66196f7cc270a0532ea989f2fc6bc6885d.zip | |
Adopt let else in more places
Diffstat (limited to 'compiler/rustc_mir_dataflow/src/impls/mod.rs')
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/impls/mod.rs | 20 | 
1 files changed, 8 insertions, 12 deletions
| diff --git a/compiler/rustc_mir_dataflow/src/impls/mod.rs b/compiler/rustc_mir_dataflow/src/impls/mod.rs index 5dc8a003b47..63d935db8ca 100644 --- a/compiler/rustc_mir_dataflow/src/impls/mod.rs +++ b/compiler/rustc_mir_dataflow/src/impls/mod.rs @@ -385,16 +385,14 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, 'tcx> { switch_on_enum_discriminant(self.tcx, &self.body, &self.body[block], discr) }); - let (enum_place, enum_def) = match enum_ { - Some(x) => x, - None => return, + let Some((enum_place, enum_def)) = enum_ else { + return; }; let mut discriminants = enum_def.discriminants(self.tcx); edge_effects.apply(|trans, edge| { - let value = match edge.value { - Some(x) => x, - None => return, + let Some(value) = edge.value else { + return; }; // MIR building adds discriminants to the `values` array in the same order as they @@ -507,16 +505,14 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeUninitializedPlaces<'_, 'tcx> { switch_on_enum_discriminant(self.tcx, &self.body, &self.body[block], discr) }); - let (enum_place, enum_def) = match enum_ { - Some(x) => x, - None => return, + let Some((enum_place, enum_def)) = enum_ else { + return; }; let mut discriminants = enum_def.discriminants(self.tcx); edge_effects.apply(|trans, edge| { - let value = match edge.value { - Some(x) => x, - None => return, + let Some(value) = edge.value else { + return; }; // MIR building adds discriminants to the `values` array in the same order as they | 
