Skip to content

Commit 0c1ef98

Browse files
committed
Use match ergonomics compatible with editions 2021 and 2024
1 parent 625d391 commit 0c1ef98

33 files changed

+66
-69
lines changed

clippy_lints/src/checked_conversions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ fn get_types_from_cast<'a>(
232232
// or `to_type::MAX as from_type`
233233
let call_from_cast: Option<(&Expr<'_>, &str)> = if let ExprKind::Cast(limit, from_type) = &expr.kind
234234
// to_type::max_value(), from_type
235-
&& let TyKind::Path(ref from_type_path) = &from_type.kind
235+
&& let TyKind::Path(from_type_path) = &from_type.kind
236236
&& let Some(from_sym) = int_ty_to_sym(from_type_path)
237237
{
238238
Some((limit, from_sym))
@@ -245,7 +245,7 @@ fn get_types_from_cast<'a>(
245245
if let ExprKind::Call(from_func, [limit]) = &expr.kind
246246
// `from_type::from, to_type::max_value()`
247247
// `from_type::from`
248-
&& let ExprKind::Path(ref path) = &from_func.kind
248+
&& let ExprKind::Path(path) = &from_func.kind
249249
&& let Some(from_sym) = get_implementing_type(path, INTS, "from")
250250
{
251251
Some((limit, from_sym))

clippy_lints/src/copy_iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ declare_lint_pass!(CopyIterator => [COPY_ITERATOR]);
3737
impl<'tcx> LateLintPass<'tcx> for CopyIterator {
3838
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
3939
if let ItemKind::Impl(Impl {
40-
of_trait: Some(ref trait_ref),
40+
of_trait: Some(trait_ref),
4141
..
4242
}) = item.kind
4343
&& let ty = cx.tcx.type_of(item.owner_id).instantiate_identity()

clippy_lints/src/derivable_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn check_enum<'tcx>(cx: &LateContext<'tcx>, item: &'tcx Item<'_>, func_expr: &Ex
187187
impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
188188
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
189189
if let ItemKind::Impl(Impl {
190-
of_trait: Some(ref trait_ref),
190+
of_trait: Some(trait_ref),
191191
items: [child],
192192
self_ty,
193193
..

clippy_lints/src/derive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ declare_lint_pass!(Derive => [
202202
impl<'tcx> LateLintPass<'tcx> for Derive {
203203
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
204204
if let ItemKind::Impl(Impl {
205-
of_trait: Some(ref trait_ref),
205+
of_trait: Some(trait_ref),
206206
..
207207
}) = item.kind
208208
{

clippy_lints/src/disallowed_script_idents.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl EarlyLintPass for DisallowedScriptIdents {
8080
let mut symbols: Vec<_> = symbols.iter().collect();
8181
symbols.sort_unstable_by_key(|k| k.1);
8282

83-
for (symbol, &span) in &symbols {
83+
for &(symbol, &span) in &symbols {
8484
// Note: `symbol.as_str()` is an expensive operation, thus should not be called
8585
// more than once for a single symbol.
8686
let symbol_str = symbol.as_str();

clippy_lints/src/empty_drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ declare_lint_pass!(EmptyDrop => [EMPTY_DROP]);
3636
impl LateLintPass<'_> for EmptyDrop {
3737
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
3838
if let ItemKind::Impl(Impl {
39-
of_trait: Some(ref trait_ref),
39+
of_trait: Some(trait_ref),
4040
items: [child],
4141
..
4242
}) = item.kind

clippy_lints/src/len_zero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ fn has_is_empty(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
629629
.filter_by_name_unhygienic(is_empty)
630630
.any(|item| is_is_empty(cx, item))
631631
}),
632-
ty::Alias(ty::Projection, ref proj) => has_is_empty_impl(cx, proj.def_id),
632+
ty::Alias(ty::Projection, proj) => has_is_empty_impl(cx, proj.def_id),
633633
ty::Adt(id, _) => has_is_empty_impl(cx, id.did()),
634634
ty::Array(..) | ty::Slice(..) | ty::Str => true,
635635
_ => false,

clippy_lints/src/lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ impl<'tcx> Visitor<'tcx> for RefVisitor<'_, 'tcx> {
425425
self.visit_opaque_ty(opaque);
426426
self.lts.truncate(len);
427427
self.lts.extend(bounds.iter().filter_map(|bound| match bound {
428-
GenericArg::Lifetime(&l) => Some(l),
428+
&GenericArg::Lifetime(l) => Some(l),
429429
_ => None,
430430
}));
431431
},

clippy_lints/src/manual_async_fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn captures_all_lifetimes(inputs: &[Ty<'_>], output_lifetimes: &[LifetimeName])
169169
}
170170

171171
fn desugared_async_block<'tcx>(cx: &LateContext<'tcx>, block: &'tcx Block<'tcx>) -> Option<&'tcx Body<'tcx>> {
172-
if let Some(Expr {
172+
if let Some(&Expr {
173173
kind: ExprKind::Closure(&Closure { kind, body, .. }),
174174
..
175175
}) = block.expr

clippy_lints/src/matches/match_like_matches.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ fn find_bool_lit(ex: &ExprKind<'_>) -> Option<bool> {
148148
}) => Some(*b),
149149
ExprKind::Block(
150150
rustc_hir::Block {
151-
stmts: &[],
151+
stmts: [],
152152
expr: Some(exp),
153153
..
154154
},

clippy_lints/src/matches/redundant_pattern_match.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,9 @@ fn found_good_method<'tcx>(
319319
node: (&PatKind<'_>, &PatKind<'_>),
320320
) -> Option<(&'static str, Option<&'tcx Expr<'tcx>>)> {
321321
match node {
322-
(
323-
PatKind::TupleStruct(ref path_left, patterns_left, _),
324-
PatKind::TupleStruct(ref path_right, patterns_right, _),
325-
) if patterns_left.len() == 1 && patterns_right.len() == 1 => {
322+
(PatKind::TupleStruct(path_left, patterns_left, _), PatKind::TupleStruct(path_right, patterns_right, _))
323+
if patterns_left.len() == 1 && patterns_right.len() == 1 =>
324+
{
326325
if let (PatKind::Wild, PatKind::Wild) = (&patterns_left[0].kind, &patterns_right[0].kind) {
327326
find_good_method_for_match(
328327
cx,
@@ -350,8 +349,8 @@ fn found_good_method<'tcx>(
350349
None
351350
}
352351
},
353-
(PatKind::TupleStruct(ref path_left, patterns, _), PatKind::Path(ref path_right))
354-
| (PatKind::Path(ref path_left), PatKind::TupleStruct(ref path_right, patterns, _))
352+
(PatKind::TupleStruct(path_left, patterns, _), PatKind::Path(path_right))
353+
| (PatKind::Path(path_left), PatKind::TupleStruct(path_right, patterns, _))
355354
if patterns.len() == 1 =>
356355
{
357356
if let PatKind::Wild = patterns[0].kind {
@@ -381,14 +380,14 @@ fn found_good_method<'tcx>(
381380
None
382381
}
383382
},
384-
(PatKind::TupleStruct(ref path_left, patterns, _), PatKind::Wild) if patterns.len() == 1 => {
383+
(PatKind::TupleStruct(path_left, patterns, _), PatKind::Wild) if patterns.len() == 1 => {
385384
if let PatKind::Wild = patterns[0].kind {
386385
get_good_method(cx, arms, path_left)
387386
} else {
388387
None
389388
}
390389
},
391-
(PatKind::Path(ref path_left), PatKind::Wild) => get_good_method(cx, arms, path_left),
390+
(PatKind::Path(path_left), PatKind::Wild) => get_good_method(cx, arms, path_left),
392391
_ => None,
393392
}
394393
}

clippy_lints/src/methods/filter_map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ fn is_method(cx: &LateContext<'_>, expr: &Expr<'_>, method_name: Symbol) -> bool
2121
ExprKind::Path(QPath::TypeRelative(_, mname)) => mname.ident.name == method_name,
2222
ExprKind::Path(QPath::Resolved(_, segments)) => segments.segments.last().unwrap().ident.name == method_name,
2323
ExprKind::MethodCall(segment, _, _, _) => segment.ident.name == method_name,
24-
ExprKind::Closure(&Closure { body, .. }) => {
25-
let body = cx.tcx.hir().body(body);
24+
ExprKind::Closure(Closure { body, .. }) => {
25+
let body = cx.tcx.hir().body(*body);
2626
let closure_expr = peel_blocks(body.value);
2727
match closure_expr.kind {
2828
ExprKind::MethodCall(PathSegment { ident, .. }, receiver, ..) => {

clippy_lints/src/needless_late_init.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessLateInit {
347347
if let LetStmt {
348348
init: None,
349349
pat:
350-
&Pat {
350+
Pat {
351351
kind: PatKind::Binding(BindingMode::NONE, binding_id, _, None),
352352
..
353353
},
@@ -357,7 +357,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessLateInit {
357357
&& let Some((_, Node::Stmt(local_stmt))) = parents.next()
358358
&& let Some((_, Node::Block(block))) = parents.next()
359359
{
360-
check(cx, local, local_stmt, block, binding_id);
360+
check(cx, local, local_stmt, block, *binding_id);
361361
}
362362
}
363363
}

clippy_lints/src/needless_pass_by_ref_mut.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByRefMut<'tcx> {
183183
.iter()
184184
.zip(fn_sig.inputs())
185185
.zip(body.params)
186-
.filter(|((&input, &ty), arg)| !should_skip(cx, input, ty, arg))
186+
.filter(|&((&input, &ty), arg)| !should_skip(cx, input, ty, arg))
187187
.peekable();
188188
if it.peek().is_none() {
189189
return;

clippy_lints/src/partialeq_ne_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ declare_lint_pass!(PartialEqNeImpl => [PARTIALEQ_NE_IMPL]);
3434
impl<'tcx> LateLintPass<'tcx> for PartialEqNeImpl {
3535
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
3636
if let ItemKind::Impl(Impl {
37-
of_trait: Some(ref trait_ref),
37+
of_trait: Some(trait_ref),
3838
items: impl_items,
3939
..
4040
}) = item.kind

clippy_lints/src/question_mark.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ enum IfBlockType<'hir> {
9393

9494
fn find_let_else_ret_expression<'hir>(block: &'hir Block<'hir>) -> Option<&'hir Expr<'hir>> {
9595
if let Block {
96-
stmts: &[],
96+
stmts: [],
9797
expr: Some(els),
9898
..
9999
} = block

clippy_lints/src/ref_option_ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<'tcx> LateLintPass<'tcx> for RefOptionRef {
3939
fn check_ty(&mut self, cx: &LateContext<'tcx>, ty: &'tcx Ty<'tcx>) {
4040
if let TyKind::Ref(_, ref mut_ty) = ty.kind
4141
&& mut_ty.mutbl == Mutability::Not
42-
&& let TyKind::Path(ref qpath) = &mut_ty.ty.kind
42+
&& let TyKind::Path(qpath) = &mut_ty.ty.kind
4343
&& let last = last_path_segment(qpath)
4444
&& let Some(def_id) = last.res.opt_def_id()
4545
&& cx.tcx.is_diagnostic_item(sym::Option, def_id)

clippy_lints/src/returns.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ fn check_final_expr<'tcx>(
347347
let peeled_drop_expr = expr.peel_drop_temps();
348348
match &peeled_drop_expr.kind {
349349
// simple return is always "bad"
350-
ExprKind::Ret(ref inner) => {
350+
ExprKind::Ret(inner) => {
351351
// check if expr return nothing
352352
let ret_span = if inner.is_none() && replacement == RetReplacement::Empty {
353353
extend_span_to_previous_non_ws(cx, peeled_drop_expr.span)

clippy_lints/src/serde_api.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ declare_lint_pass!(SerdeApi => [SERDE_API_MISUSE]);
2626
impl<'tcx> LateLintPass<'tcx> for SerdeApi {
2727
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
2828
if let ItemKind::Impl(Impl {
29-
of_trait: Some(ref trait_ref),
29+
of_trait: Some(trait_ref),
3030
items,
3131
..
3232
}) = item.kind

clippy_lints/src/single_component_path_imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl SingleComponentPathImports {
174174
}
175175

176176
match &item.kind {
177-
ItemKind::Mod(_, ModKind::Loaded(ref items, ..)) => {
177+
ItemKind::Mod(_, ModKind::Loaded(items, ..)) => {
178178
self.check_mod(items);
179179
},
180180
ItemKind::MacroDef(MacroDef { macro_rules: true, .. }) => {

clippy_lints/src/suspicious_operation_groupings.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ fn strip_non_ident_wrappers(expr: &Expr) -> &Expr {
334334
let mut output = expr;
335335
loop {
336336
output = match &output.kind {
337-
ExprKind::Paren(ref inner) | ExprKind::Unary(_, ref inner) => inner,
337+
ExprKind::Paren(inner) | ExprKind::Unary(_, inner) => inner,
338338
_ => {
339339
return output;
340340
},
@@ -348,13 +348,13 @@ fn extract_related_binops(kind: &ExprKind) -> Option<Vec<BinaryOp<'_>>> {
348348

349349
fn if_statement_binops(kind: &ExprKind) -> Option<Vec<BinaryOp<'_>>> {
350350
match kind {
351-
ExprKind::If(ref condition, _, _) => chained_binops(&condition.kind),
352-
ExprKind::Paren(ref e) => if_statement_binops(&e.kind),
353-
ExprKind::Block(ref block, _) => {
351+
ExprKind::If(condition, _, _) => chained_binops(&condition.kind),
352+
ExprKind::Paren(e) => if_statement_binops(&e.kind),
353+
ExprKind::Block(block, _) => {
354354
let mut output = None;
355355
for stmt in &block.stmts {
356-
match stmt.kind {
357-
StmtKind::Expr(ref e) | StmtKind::Semi(ref e) => {
356+
match &stmt.kind {
357+
StmtKind::Expr(e) | StmtKind::Semi(e) => {
358358
output = append_opt_vecs(output, if_statement_binops(&e.kind));
359359
},
360360
_ => {},
@@ -383,24 +383,22 @@ fn append_opt_vecs<A>(target_opt: Option<Vec<A>>, source_opt: Option<Vec<A>>) ->
383383
fn chained_binops(kind: &ExprKind) -> Option<Vec<BinaryOp<'_>>> {
384384
match kind {
385385
ExprKind::Binary(_, left_outer, right_outer) => chained_binops_helper(left_outer, right_outer),
386-
ExprKind::Paren(ref e) | ExprKind::Unary(_, ref e) => chained_binops(&e.kind),
386+
ExprKind::Paren(e) | ExprKind::Unary(_, e) => chained_binops(&e.kind),
387387
_ => None,
388388
}
389389
}
390390

391391
fn chained_binops_helper<'expr>(left_outer: &'expr Expr, right_outer: &'expr Expr) -> Option<Vec<BinaryOp<'expr>>> {
392392
match (&left_outer.kind, &right_outer.kind) {
393393
(
394-
ExprKind::Paren(ref left_e) | ExprKind::Unary(_, ref left_e),
395-
ExprKind::Paren(ref right_e) | ExprKind::Unary(_, ref right_e),
394+
ExprKind::Paren(left_e) | ExprKind::Unary(_, left_e),
395+
ExprKind::Paren(right_e) | ExprKind::Unary(_, right_e),
396396
) => chained_binops_helper(left_e, right_e),
397-
(ExprKind::Paren(ref left_e) | ExprKind::Unary(_, ref left_e), _) => chained_binops_helper(left_e, right_outer),
398-
(_, ExprKind::Paren(ref right_e) | ExprKind::Unary(_, ref right_e)) => {
399-
chained_binops_helper(left_outer, right_e)
400-
},
397+
(ExprKind::Paren(left_e) | ExprKind::Unary(_, left_e), _) => chained_binops_helper(left_e, right_outer),
398+
(_, ExprKind::Paren(right_e) | ExprKind::Unary(_, right_e)) => chained_binops_helper(left_outer, right_e),
401399
(
402-
ExprKind::Binary(Spanned { node: left_op, .. }, ref left_left, ref left_right),
403-
ExprKind::Binary(Spanned { node: right_op, .. }, ref right_left, ref right_right),
400+
ExprKind::Binary(Spanned { node: left_op, .. }, left_left, left_right),
401+
ExprKind::Binary(Spanned { node: right_op, .. }, right_left, right_right),
404402
) => match (
405403
chained_binops_helper(left_left, left_right),
406404
chained_binops_helper(right_left, right_right),

clippy_lints/src/swap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ impl<'tcx> IndexBinding<'_, 'tcx> {
392392
for stmt in self.block.stmts {
393393
match stmt.kind {
394394
StmtKind::Expr(expr) | StmtKind::Semi(expr) => v.visit_expr(expr),
395-
StmtKind::Let(LetStmt { ref init, .. }) => {
395+
StmtKind::Let(LetStmt { init, .. }) => {
396396
if let Some(init) = init.as_ref() {
397397
v.visit_expr(init);
398398
}

clippy_lints/src/trait_bounds.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'tcx> LateLintPass<'tcx> for TraitBounds {
124124
let mut self_bounds_map = FxHashMap::default();
125125

126126
for predicate in item.generics.predicates {
127-
if let WherePredicate::BoundPredicate(ref bound_predicate) = predicate
127+
if let WherePredicate::BoundPredicate(bound_predicate) = predicate
128128
&& bound_predicate.origin != PredicateOrigin::ImplTrait
129129
&& !bound_predicate.span.from_expansion()
130130
&& let TyKind::Path(QPath::Resolved(_, Path { segments, .. })) = bound_predicate.bounded_ty.kind
@@ -268,7 +268,7 @@ impl TraitBounds {
268268
let mut map: UnhashMap<SpanlessTy<'_, '_>, Vec<&GenericBound<'_>>> = UnhashMap::default();
269269
let mut applicability = Applicability::MaybeIncorrect;
270270
for bound in generics.predicates {
271-
if let WherePredicate::BoundPredicate(ref p) = bound
271+
if let WherePredicate::BoundPredicate(p) = bound
272272
&& p.origin != PredicateOrigin::ImplTrait
273273
&& p.bounds.len() as u64 <= self.max_trait_bounds
274274
&& !p.span.from_expansion()

clippy_lints/src/undocumented_unsafe_blocks.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ fn expr_has_unnecessary_safety_comment<'tcx>(
295295
if cx.tcx.hir().parent_iter(expr.hir_id).any(|(_, ref node)| {
296296
matches!(
297297
node,
298-
Node::Block(&Block {
298+
Node::Block(Block {
299299
rules: BlockCheckMode::UnsafeBlock(UnsafeSource::UserProvided),
300300
..
301301
}),

clippy_lints/src/unit_types/let_unit_value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ fn needs_inferred_result_ty(
194194
let (id, receiver, args) = match e.kind {
195195
ExprKind::Call(
196196
Expr {
197-
kind: ExprKind::Path(ref path),
197+
kind: ExprKind::Path(path),
198198
hir_id,
199199
..
200200
},

clippy_lints/src/unit_types/unit_arg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn is_empty_block(expr: &Expr<'_>) -> bool {
149149
expr.kind,
150150
ExprKind::Block(
151151
Block {
152-
stmts: &[],
152+
stmts: [],
153153
expr: None,
154154
..
155155
},

clippy_lints/src/unused_io_amount.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ fn unpack_call_chain<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
244244
}
245245

246246
fn unpack_try<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
247-
while let ExprKind::Call(func, [ref arg_0]) = expr.kind
247+
while let ExprKind::Call(func, [arg_0]) = expr.kind
248248
&& matches!(
249249
func.kind,
250250
ExprKind::Path(hir::QPath::LangItem(hir::LangItem::TryTraitBranch, ..))
@@ -266,7 +266,7 @@ fn unpack_match<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
266266
/// waited on. Otherwise return None.
267267
fn unpack_await<'a>(expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
268268
if let ExprKind::Match(expr, _, hir::MatchSource::AwaitDesugar) = expr.kind {
269-
if let ExprKind::Call(func, [ref arg_0]) = expr.kind {
269+
if let ExprKind::Call(func, [arg_0]) = expr.kind {
270270
if matches!(
271271
func.kind,
272272
ExprKind::Path(hir::QPath::LangItem(hir::LangItem::IntoFutureIntoFuture, ..))

clippy_lints/src/utils/author.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
396396
self.pat(field!(let_expr.pat));
397397
// Does what ExprKind::Cast does, only adds a clause for the type
398398
// if it's a path
399-
if let Some(TyKind::Path(ref qpath)) = let_expr.value.ty.as_ref().map(|ty| &ty.kind) {
399+
if let Some(TyKind::Path(qpath)) = let_expr.value.ty.as_ref().map(|ty| &ty.kind) {
400400
bind!(self, qpath);
401401
chain!(self, "let TyKind::Path(ref {qpath}) = {let_expr}.ty.kind");
402402
self.qpath(qpath);

clippy_lints/src/utils/internal_lints/collapsible_calls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl<'tcx> LateLintPass<'tcx> for CollapsibleCalls {
7979

8080
if let ExprKind::Call(func, [call_cx, call_lint, call_sp, call_msg, call_f]) = expr.kind
8181
&& is_expr_path_def_path(cx, func, &["clippy_utils", "diagnostics", "span_lint_and_then"])
82-
&& let ExprKind::Closure(&Closure { body, .. }) = &call_f.kind
82+
&& let ExprKind::Closure(&Closure { body, .. }) = call_f.kind
8383
&& let body = cx.tcx.hir().body(body)
8484
&& let only_expr = peel_blocks_with_stmt(body.value)
8585
&& let ExprKind::MethodCall(ps, recv, span_call_args, _) = &only_expr.kind

0 commit comments

Comments
 (0)