clippy: replace `box_patterns` usage with `deref_patterns`
diff --git a/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs b/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs index e3660fa..944dedb 100644 --- a/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs +++ b/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs
@@ -158,13 +158,13 @@ fn eq_expr(l: &Expr, r: &Expr) -> bool { (Repeat(le, ls), Repeat(re, rs)) => eq_expr(le, re) && eq_expr(&ls.value, &rs.value), (Call(lc, la), Call(rc, ra)) => eq_expr(lc, rc) && over(la, ra, |l, r| eq_expr(l, r)), ( - MethodCall(box ast::MethodCall { + MethodCall(ast::MethodCall { seg: ls, receiver: lr, args: la, .. }), - MethodCall(box ast::MethodCall { + MethodCall(ast::MethodCall { seg: rs, receiver: rr, args: ra, @@ -205,7 +205,7 @@ fn eq_expr(l: &Expr, r: &Expr) -> bool { (Field(lp, lf), Field(rp, rf)) => eq_id(*lf, *rf) && eq_expr(lp, rp), (Match(ls, la, lkind), Match(rs, ra, rkind)) => (lkind == rkind) && eq_expr(ls, rs) && over(la, ra, eq_arm), ( - Closure(box ast::Closure { + Closure(ast::Closure { binder: lb, capture_clause: lc, coroutine_marker: lcm, @@ -214,7 +214,7 @@ fn eq_expr(l: &Expr, r: &Expr) -> bool { body: le, .. }), - Closure(box ast::Closure { + Closure(ast::Closure { binder: rb, capture_clause: rc, coroutine_marker: rcm, @@ -311,7 +311,7 @@ fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool { (ExternCrate(ls, li), ExternCrate(rs, ri)) => ls == rs && eq_id(*li, *ri), (Use(l), Use(r)) => eq_use_tree(l, r), ( - Static(box StaticItem { + Static(StaticItem { ident: li, ty: lt, mutability: lm, @@ -320,7 +320,7 @@ fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool { define_opaque: _, eii_impl: _, }), - Static(box StaticItem { + Static(StaticItem { ident: ri, ty: rt, mutability: rm, @@ -331,7 +331,7 @@ fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool { }), ) => eq_id(*li, *ri) && lm == rm && ls == rs && eq_ty(lt, rt) && eq_expr_opt(le.as_deref(), re.as_deref()), ( - Const(box ConstItem { + Const(ConstItem { defaultness: ld, ident: li, generics: lg, @@ -340,7 +340,7 @@ fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool { kind: lk, define_opaque: _, }), - Const(box ConstItem { + Const(ConstItem { defaultness: rd, ident: ri, generics: rg, @@ -359,7 +359,7 @@ fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool { && both(lb.as_deref(), rb.as_deref(), eq_expr) }, ( - Fn(box ast::Fn { + Fn(ast::Fn { defaultness: ld, sig: lf, ident: li, @@ -369,7 +369,7 @@ fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool { define_opaque: _, eii_impl: _, }), - Fn(box ast::Fn { + Fn(ast::Fn { defaultness: rd, sig: rf, ident: ri, @@ -403,14 +403,14 @@ fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool { && over(&l.items, &r.items, |l, r| eq_item(l, r, eq_foreign_item_kind)) }, ( - TyAlias(box ast::TyAlias { + TyAlias(ast::TyAlias { defaultness: ld, generics: lg, bounds: lb, ty: lt, .. }), - TyAlias(box ast::TyAlias { + TyAlias(ast::TyAlias { defaultness: rd, generics: rg, bounds: rb, @@ -430,7 +430,7 @@ fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool { eq_id(*li, *ri) && eq_generics(lg, rg) && eq_variant_data(lv, rv) }, ( - Trait(box ast::Trait { + Trait(ast::Trait { impl_restriction: liprt, constness: lc, is_auto: la, @@ -440,7 +440,7 @@ fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool { bounds: lb, items: lis, }), - Trait(box ast::Trait { + Trait(ast::Trait { impl_restriction: riprt, constness: rc, is_auto: ra, @@ -461,13 +461,13 @@ fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool { && over(lis, ris, |l, r| eq_item(l, r, eq_assoc_item_kind)) }, ( - TraitAlias(box ast::TraitAlias { + TraitAlias(ast::TraitAlias { ident: li, generics: lg, bounds: lb, constness: lc, }), - TraitAlias(box ast::TraitAlias { + TraitAlias(ast::TraitAlias { ident: ri, generics: rg, bounds: rb, @@ -518,7 +518,7 @@ fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool { use ForeignItemKind::*; match (l, r) { ( - Static(box StaticItem { + Static(StaticItem { ident: li, ty: lt, mutability: lm, @@ -527,7 +527,7 @@ fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool { define_opaque: _, eii_impl: _, }), - Static(box StaticItem { + Static(StaticItem { ident: ri, ty: rt, mutability: rm, @@ -538,7 +538,7 @@ fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool { }), ) => eq_id(*li, *ri) && eq_ty(lt, rt) && lm == rm && eq_expr_opt(le.as_deref(), re.as_deref()) && ls == rs, ( - Fn(box ast::Fn { + Fn(ast::Fn { defaultness: ld, sig: lf, ident: li, @@ -548,7 +548,7 @@ fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool { define_opaque: _, eii_impl: _, }), - Fn(box ast::Fn { + Fn(ast::Fn { defaultness: rd, sig: rf, ident: ri, @@ -567,7 +567,7 @@ fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool { && both(lb.as_ref(), rb.as_ref(), |l, r| eq_block(l, r)) }, ( - TyAlias(box ast::TyAlias { + TyAlias(ast::TyAlias { defaultness: ld, ident: li, generics: lg, @@ -575,7 +575,7 @@ fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool { bounds: lb, ty: lt, }), - TyAlias(box ast::TyAlias { + TyAlias(ast::TyAlias { defaultness: rd, ident: ri, generics: rg, @@ -600,7 +600,7 @@ fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool { use AssocItemKind::*; match (l, r) { ( - Const(box ConstItem { + Const(ConstItem { defaultness: ld, ident: li, generics: lg, @@ -609,7 +609,7 @@ fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool { kind: lk, define_opaque: _, }), - Const(box ConstItem { + Const(ConstItem { defaultness: rd, ident: ri, generics: rg, @@ -627,7 +627,7 @@ fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool { && both(lb.as_deref(), rb.as_deref(), eq_expr) }, ( - Fn(box ast::Fn { + Fn(ast::Fn { defaultness: ld, sig: lf, ident: li, @@ -637,7 +637,7 @@ fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool { define_opaque: _, eii_impl: _, }), - Fn(box ast::Fn { + Fn(ast::Fn { defaultness: rd, sig: rf, ident: ri, @@ -656,7 +656,7 @@ fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool { && both(lb.as_ref(), rb.as_ref(), |l, r| eq_block(l, r)) }, ( - Type(box TyAlias { + Type(TyAlias { defaultness: ld, ident: li, generics: lg, @@ -664,7 +664,7 @@ fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool { bounds: lb, ty: lt, }), - Type(box TyAlias { + Type(TyAlias { defaultness: rd, ident: ri, generics: rg,
diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 8b47c79..8ee6778 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs
@@ -1,4 +1,3 @@ -#![feature(box_patterns)] #![feature(deref_patterns)] #![feature(macro_metavar_expr)] #![feature(rustc_private)]
diff --git a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs index 820c8b5..3033755 100644 --- a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs +++ b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs
@@ -194,7 +194,7 @@ fn check_rvalue<'tcx>( "transmute can attempt to turn pointers into integers, so is unstable in const fn".into(), )), // binops are fine on integers - Rvalue::BinaryOp(_, box (lhs, rhs)) => { + Rvalue::BinaryOp(_, (lhs, rhs)) => { check_operand(cx, lhs, span, body, msrv)?; check_operand(cx, rhs, span, body, msrv)?; let ty = lhs.ty(body, cx.tcx); @@ -236,18 +236,18 @@ fn check_statement<'tcx>( ) -> McfResult { let span = statement.source_info.span; match &statement.kind { - StatementKind::Assign(box (place, rval)) => { + StatementKind::Assign((place, rval)) => { check_place(cx, *place, span, body, msrv)?; check_rvalue(cx, body, def_id, rval, span, msrv) }, - StatementKind::FakeRead(box (_, place)) => check_place(cx, *place, span, body, msrv), + StatementKind::FakeRead((_, place)) => check_place(cx, *place, span, body, msrv), // just an assignment StatementKind::SetDiscriminant { place, .. } => check_place(cx, **place, span, body, msrv), - StatementKind::Intrinsic(box NonDivergingIntrinsic::Assume(op)) => check_operand(cx, op, span, body, msrv), + StatementKind::Intrinsic(NonDivergingIntrinsic::Assume(op)) => check_operand(cx, op, span, body, msrv), - StatementKind::Intrinsic(box NonDivergingIntrinsic::CopyNonOverlapping( + StatementKind::Intrinsic(NonDivergingIntrinsic::CopyNonOverlapping( rustc_middle::mir::CopyNonOverlapping { dst, src, count }, )) => { check_operand(cx, dst, span, body, msrv)?;