diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-02-23 19:56:35 +0100 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2024-02-23 19:56:35 +0100 |
| commit | 86a7fc840f11cd1f20fdf26d3071e34a2d4bc313 (patch) | |
| tree | 825af3e5f80cc4cb41aca59fe20467a382b2ae22 /compiler/rustc_mir_build/src | |
| parent | b6a23b853719c8c22c022993c9eb2871b09fc2b9 (diff) | |
| download | rust-86a7fc840f11cd1f20fdf26d3071e34a2d4bc313.tar.gz rust-86a7fc840f11cd1f20fdf26d3071e34a2d4bc313.zip | |
compiler: clippy::complexity fixes
Diffstat (limited to 'compiler/rustc_mir_build/src')
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/mod.rs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs index 0329e1d3096..0b03cb52373 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs @@ -223,19 +223,14 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { // If we are handling a range with associated constants (e.g. // `Foo::<'a>::A..=Foo::B`), we need to put the ascriptions for the associated // constants somewhere. Have them on the range pattern. - for ascr in [lo_ascr, hi_ascr] { - if let Some(ascription) = ascr { - kind = PatKind::AscribeUserType { - ascription, - subpattern: Box::new(Pat { span, ty, kind }), - }; - } + for ascription in [lo_ascr, hi_ascr].into_iter().flatten() { + kind = PatKind::AscribeUserType { + ascription, + subpattern: Box::new(Pat { span, ty, kind }), + }; } - for inline_const in [lo_inline, hi_inline] { - if let Some(def) = inline_const { - kind = - PatKind::InlineConstant { def, subpattern: Box::new(Pat { span, ty, kind }) }; - } + for def in [lo_inline, hi_inline].into_iter().flatten() { + kind = PatKind::InlineConstant { def, subpattern: Box::new(Pat { span, ty, kind }) }; } Ok(kind) } |
