diff --git a/clippy_lints/src/dereference.rs b/clippy_lints/src/dereference.rs index 45ee2fce4e47..aba2a8a82762 100644 --- a/clippy_lints/src/dereference.rs +++ b/clippy_lints/src/dereference.rs @@ -274,9 +274,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> { } let typeck = cx.typeck_results(); - let (kind, sub_expr) = if let Some(x) = try_parse_ref_op(cx.tcx, typeck, expr) { - x - } else { + let Some((kind, sub_expr)) = try_parse_ref_op(cx.tcx, typeck, expr) else { // The whole chain of reference operations has been seen if let Some((state, data)) = self.state.take() { report(cx, expr, state, data); diff --git a/clippy_utils/src/consts.rs b/clippy_utils/src/consts.rs index 07e4ef6a2fef..f01afda72b2c 100644 --- a/clippy_utils/src/consts.rs +++ b/clippy_utils/src/consts.rs @@ -147,9 +147,8 @@ impl Constant { _ => None, }, (&Self::Vec(ref l), &Self::Vec(ref r)) => { - let cmp_type = match *cmp_type.kind() { - ty::Array(ty, _) | ty::Slice(ty) => ty, - _ => return None, + let (ty::Array(cmp_type, _) | ty::Slice(cmp_type)) = *cmp_type.kind() else { + return None }; iter::zip(l, r) .map(|(li, ri)| Self::partial_cmp(tcx, cmp_type, li, ri)) @@ -401,10 +400,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> { use self::Constant::{Int, F32, F64}; match *o { Int(value) => { - let ity = match *ty.kind() { - ty::Int(ity) => ity, - _ => return None, - }; + let ty::Int(ity) = *ty.kind() else { return None }; // sign extend let value = sext(self.lcx.tcx, value, ity); let value = value.checked_neg()?; diff --git a/clippy_utils/src/hir_utils.rs b/clippy_utils/src/hir_utils.rs index cf24ec8b67b9..02b973e5b278 100644 --- a/clippy_utils/src/hir_utils.rs +++ b/clippy_utils/src/hir_utils.rs @@ -131,13 +131,10 @@ impl HirEqInterExpr<'_, '_, '_> { ([], None, [], None) => { // For empty blocks, check to see if the tokens are equal. This will catch the case where a macro // expanded to nothing, or the cfg attribute was used. - let (left, right) = match ( + let (Some(left), Some(right)) = ( snippet_opt(self.inner.cx, left.span), snippet_opt(self.inner.cx, right.span), - ) { - (Some(left), Some(right)) => (left, right), - _ => return true, - }; + ) else { return true }; let mut left_pos = 0; let left = tokenize(&left) .map(|t| {