From 86a7fc840f11cd1f20fdf26d3071e34a2d4bc313 Mon Sep 17 00:00:00 2001 From: Matthias Krüger Date: Fri, 23 Feb 2024 19:56:35 +0100 Subject: compiler: clippy::complexity fixes --- compiler/rustc_mir_build/src/thir/pattern/mod.rs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'compiler/rustc_mir_build/src') 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) } -- cgit 1.4.1-3-g733a5