Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clippy_lints/src/assigning_clones.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ fn clone_source_borrows_from_dest(cx: &LateContext<'_>, lhs: &Expr<'_>, call_spa
.find(|stmt| {
!matches!(stmt.kind, mir::StatementKind::StorageDead(_) | mir::StatementKind::StorageLive(_))
})
&& let mir::StatementKind::Assign(box (borrowed, _)) = &assignment.kind
&& let mir::StatementKind::Assign((borrowed, _)) = &assignment.kind
&& let Some(borrowers) = borrow_map.get(&borrowed.local)
{
borrowers.contains(source.local)
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/double_parens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl EarlyLintPass for DoubleParens {
// ^^^^^^^^^ expr
// ^^^ arg
// ^ inner
ExprKind::Call(_, args) | ExprKind::MethodCall(box MethodCall { args, .. })
ExprKind::Call(_, args) | ExprKind::MethodCall(MethodCall { args, .. })
if let [arg] = &**args
&& let ExprKind::Paren(inner) = &arg.kind
&& expr.span.eq_ctxt(arg.span)
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(box_patterns)]
#![feature(control_flow_into_value)]
#![feature(deref_patterns)]
#![feature(exact_div)]
#![feature(f128)]
#![feature(f16)]
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/needless_borrows_for_generic_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ fn referent_used_exactly_once<'tcx>(
&& let [location] = *local_assignments(mir, local).as_slice()
&& let block_data = &mir.basic_blocks[location.block]
&& let Some(statement) = block_data.statements.get(location.statement_index)
&& let StatementKind::Assign(box (_, Rvalue::Ref(_, _, place))) = statement.kind
&& let StatementKind::Assign((_, Rvalue::Ref(_, _, place))) = statement.kind
&& !place.is_indirect_first_projection()
{
let body_owner_local_def_id = cx.tcx.hir_enclosing_body_owner(reference.hir_id);
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/non_expressive_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ impl EarlyLintPass for NonExpressiveNames {
return;
}

if let ItemKind::Fn(box ast::Fn {
if let ItemKind::Fn(ast::Fn {
ref sig,
body: Some(ref blk),
..
Expand All @@ -419,7 +419,7 @@ impl EarlyLintPass for NonExpressiveNames {
return;
}

if let AssocItemKind::Fn(box ast::Fn {
if let AssocItemKind::Fn(ast::Fn {
ref sig,
body: Some(ref blk),
..
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/option_env_unwrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ declare_lint_pass!(OptionEnvUnwrap => [OPTION_ENV_UNWRAP]);

impl EarlyLintPass for OptionEnvUnwrap {
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
if let ExprKind::MethodCall(box MethodCall { seg, receiver, .. }) = &expr.kind
if let ExprKind::MethodCall(MethodCall { seg, receiver, .. }) = &expr.kind
&& matches!(seg.ident.name, sym::expect | sym::unwrap)
&& is_direct_expn_of(receiver.span, sym::option_env).is_some()
{
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ fn find_stmt_assigns_to<'tcx>(
bb: mir::BasicBlock,
) -> Option<(mir::Local, CannotMoveOut)> {
let rvalue = mir.basic_blocks[bb].statements.iter().rev().find_map(|stmt| {
if let mir::StatementKind::Assign(box (mir::Place { local, .. }, v)) = &stmt.kind {
if let mir::StatementKind::Assign((mir::Place { local, .. }, v)) = &stmt.kind {
return if *local == to_local { Some(v) } else { None };
}

Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/redundant_static_lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ impl EarlyLintPass for RedundantStaticLifetimes {
}

if !item.span.from_expansion() {
if let ItemKind::Const(box ConstItem { ty: ref var_type, .. }) = item.kind {
if let ItemKind::Const(ConstItem { ty: ref var_type, .. }) = item.kind {
Self::visit_type(var_type, cx, "constants have by default a `'static` lifetime");
// Don't check associated consts because `'static` cannot be elided on those (issue
// #2438)
}

if let ItemKind::Static(box StaticItem { ty: ref var_type, .. }) = item.kind {
if let ItemKind::Static(StaticItem { ty: ref var_type, .. }) = item.kind {
Self::visit_type(var_type, cx, "statics have by default a `'static` lifetime");
}
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/unused_rounding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ declare_clippy_lint! {
declare_lint_pass!(UnusedRounding => [UNUSED_ROUNDING]);

fn is_useless_rounding(cx: &EarlyContext<'_>, expr: &Expr) -> Option<(Symbol, String)> {
if let ExprKind::MethodCall(box MethodCall {
if let ExprKind::MethodCall(MethodCall {
seg: name_ident,
receiver,
..
Expand Down
56 changes: 28 additions & 28 deletions clippy_utils/src/ast_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -214,7 +214,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_kind: la,
Expand All @@ -223,7 +223,7 @@ fn eq_expr(l: &Expr, r: &Expr) -> bool {
body: le,
..
}),
Closure(box ast::Closure {
Closure(ast::Closure {
binder: rb,
capture_clause: rc,
coroutine_kind: ra,
Expand Down Expand Up @@ -333,7 +333,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,
Expand All @@ -342,7 +342,7 @@ fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
define_opaque: _,
eii_impls: _,
}),
Static(box StaticItem {
Static(StaticItem {
ident: ri,
ty: rt,
mutability: rm,
Expand All @@ -353,15 +353,15 @@ 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,
ty: lt,
rhs_kind: lb,
define_opaque: _,
}),
Const(box ConstItem {
Const(ConstItem {
defaultness: rd,
ident: ri,
generics: rg,
Expand All @@ -377,7 +377,7 @@ fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
&& both(Some(lb), Some(rb), eq_const_item_rhs)
},
(
Fn(box ast::Fn {
Fn(ast::Fn {
defaultness: ld,
sig: lf,
ident: li,
Expand All @@ -387,7 +387,7 @@ fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
define_opaque: _,
eii_impls: _,
}),
Fn(box ast::Fn {
Fn(ast::Fn {
defaultness: rd,
sig: rf,
ident: ri,
Expand Down Expand Up @@ -421,14 +421,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,
Expand All @@ -448,7 +448,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,
Expand All @@ -458,7 +458,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,
Expand All @@ -479,13 +479,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,
Expand Down Expand Up @@ -536,7 +536,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,
Expand All @@ -545,7 +545,7 @@ fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
define_opaque: _,
eii_impls: _,
}),
Static(box StaticItem {
Static(StaticItem {
ident: ri,
ty: rt,
mutability: rm,
Expand All @@ -556,7 +556,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,
Expand All @@ -566,7 +566,7 @@ fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
define_opaque: _,
eii_impls: _,
}),
Fn(box ast::Fn {
Fn(ast::Fn {
defaultness: rd,
sig: rf,
ident: ri,
Expand All @@ -585,15 +585,15 @@ 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,
after_where_clause: lw,
bounds: lb,
ty: lt,
}),
TyAlias(box ast::TyAlias {
TyAlias(ast::TyAlias {
defaultness: rd,
ident: ri,
generics: rg,
Expand All @@ -618,15 +618,15 @@ 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,
ty: lt,
rhs_kind: lb,
define_opaque: _,
}),
Const(box ConstItem {
Const(ConstItem {
defaultness: rd,
ident: ri,
generics: rg,
Expand All @@ -642,7 +642,7 @@ fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
&& both(Some(lb), Some(rb), eq_const_item_rhs)
},
(
Fn(box ast::Fn {
Fn(ast::Fn {
defaultness: ld,
sig: lf,
ident: li,
Expand All @@ -652,7 +652,7 @@ fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
define_opaque: _,
eii_impls: _,
}),
Fn(box ast::Fn {
Fn(ast::Fn {
defaultness: rd,
sig: rf,
ident: ri,
Expand All @@ -671,15 +671,15 @@ 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,
after_where_clause: lw,
bounds: lb,
ty: lt,
}),
Type(box TyAlias {
Type(TyAlias {
defaultness: rd,
ident: ri,
generics: rg,
Expand Down
2 changes: 1 addition & 1 deletion clippy_utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(box_patterns)]
#![feature(deref_patterns)]
#![feature(macro_metavar_expr)]
#![feature(rustc_private)]
#![feature(unwrap_infallible)]
Expand Down
2 changes: 1 addition & 1 deletion clippy_utils/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ pub fn local_assignments(mir: &Body<'_>, local: Local) -> Vec<Location> {
fn is_local_assignment(mir: &Body<'_>, local: Local, location: Location) -> bool {
match mir.stmt_at(location) {
Either::Left(statement) => {
if let StatementKind::Assign(box (place, _)) = statement.kind {
if let StatementKind::Assign((place, _)) = statement.kind {
place.as_local() == Some(local)
} else {
false
Expand Down
2 changes: 1 addition & 1 deletion clippy_utils/src/mir/possible_borrower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ fn rvalue_locals(rvalue: &mir::Rvalue<'_>, mut visit: impl FnMut(mir::Local)) {
match rvalue {
Use(op, _) | Repeat(op, _) | Cast(_, op, _) | UnaryOp(_, op) => visit_op(op),
Aggregate(_, ops) => ops.iter().for_each(visit_op),
BinaryOp(_, box (lhs, rhs)) => {
BinaryOp(_, (lhs, rhs)) => {
visit_op(lhs);
visit_op(rhs);
},
Expand Down
10 changes: 5 additions & 5 deletions clippy_utils/src/qualify_min_const_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,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);
Expand Down Expand Up @@ -229,18 +229,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)?;
Expand Down
Loading