Skip to content

Commit ae2a95f

Browse files
committed
Eat dogfood
1 parent 5782dc0 commit ae2a95f

File tree

6 files changed

+45
-57
lines changed

6 files changed

+45
-57
lines changed

clippy_lints/src/disallowed_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl DisallowedType {
4848
Self {
4949
disallowed: disallowed
5050
.iter()
51-
.map(|s| s.split("::").map(|seg| Symbol::intern(seg)).collect::<Vec<_>>())
51+
.map(|s| s.split("::").map(Symbol::intern).collect::<Vec<_>>())
5252
.collect(),
5353
def_ids: FxHashSet::default(),
5454
prim_tys: FxHashSet::default(),

clippy_lints/src/format.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ impl<'tcx> LateLintPass<'tcx> for UselessFormat {
6969
ty::Str => true,
7070
_ => false,
7171
};
72-
if format_args.args.iter().all(|e| is_display_arg(e));
73-
if format_args.fmt_expr.map_or(true, |e| check_unformatted(e));
72+
if format_args.args.iter().all(is_display_arg);
73+
if format_args.fmt_expr.map_or(true, check_unformatted);
7474
then {
7575
let is_new_string = match value.kind {
7676
ExprKind::Binary(..) => true,

clippy_lints/src/loops/while_let_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn extract_first_expr<'tcx>(block: &Block<'tcx>) -> Option<&'tcx Expr<'tcx>> {
6565
fn is_simple_break_expr(expr: &Expr<'_>) -> bool {
6666
match expr.kind {
6767
ExprKind::Break(dest, ref passed_expr) if dest.label.is_none() && passed_expr.is_none() => true,
68-
ExprKind::Block(b, _) => extract_first_expr(b).map_or(false, |subexpr| is_simple_break_expr(subexpr)),
68+
ExprKind::Block(b, _) => extract_first_expr(b).map_or(false, is_simple_break_expr),
6969
_ => false,
7070
}
7171
}

clippy_lints/src/ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ fn check_fn(cx: &LateContext<'_>, decl: &FnDecl<'_>, fn_id: HirId, opt_body_id:
372372
for (_, ref mutbl, ref argspan) in decl
373373
.inputs
374374
.iter()
375-
.filter_map(|ty| get_rptr_lm(ty))
375+
.filter_map(get_rptr_lm)
376376
.filter(|&(lt, _, _)| lt.name == out.name)
377377
{
378378
if *mutbl == Mutability::Mut {

clippy_utils/src/ast_utils.rs

Lines changed: 37 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,12 @@ pub fn eq_pat(l: &Pat, r: &Pat) -> bool {
4646
| (Ref(l, Mutability::Not), Ref(r, Mutability::Not))
4747
| (Ref(l, Mutability::Mut), Ref(r, Mutability::Mut)) => eq_pat(l, r),
4848
(Tuple(l), Tuple(r)) | (Slice(l), Slice(r)) => over(l, r, |l, r| eq_pat(l, r)),
49-
(Path(lq, lp), Path(rq, rp)) => both(lq, rq, |l, r| eq_qself(l, r)) && eq_path(lp, rp),
49+
(Path(lq, lp), Path(rq, rp)) => both(lq, rq, eq_qself) && eq_path(lp, rp),
5050
(TupleStruct(lqself, lp, lfs), TupleStruct(rqself, rp, rfs)) => {
5151
eq_maybe_qself(lqself, rqself) && eq_path(lp, rp) && over(lfs, rfs, |l, r| eq_pat(l, r))
5252
},
5353
(Struct(lqself, lp, lfs, lr), Struct(rqself, rp, rfs, rr)) => {
54-
lr == rr
55-
&& eq_maybe_qself(lqself, rqself)
56-
&& eq_path(lp, rp)
57-
&& unordered_over(lfs, rfs, |lf, rf| eq_field_pat(lf, rf))
54+
lr == rr && eq_maybe_qself(lqself, rqself) && eq_path(lp, rp) && unordered_over(lfs, rfs, eq_field_pat)
5855
},
5956
(Or(ls), Or(rs)) => unordered_over(ls, rs, |l, r| eq_pat(l, r)),
6057
(MacCall(l), MacCall(r)) => eq_mac_call(l, r),
@@ -76,7 +73,7 @@ pub fn eq_field_pat(l: &PatField, r: &PatField) -> bool {
7673
l.is_placeholder == r.is_placeholder
7774
&& eq_id(l.ident, r.ident)
7875
&& eq_pat(&l.pat, &r.pat)
79-
&& over(&l.attrs, &r.attrs, |l, r| eq_attr(l, r))
76+
&& over(&l.attrs, &r.attrs, eq_attr)
8077
}
8178

8279
pub fn eq_qself(l: &QSelf, r: &QSelf) -> bool {
@@ -92,7 +89,7 @@ pub fn eq_maybe_qself(l: &Option<QSelf>, r: &Option<QSelf>) -> bool {
9289
}
9390

9491
pub fn eq_path(l: &Path, r: &Path) -> bool {
95-
over(&l.segments, &r.segments, |l, r| eq_path_seg(l, r))
92+
over(&l.segments, &r.segments, eq_path_seg)
9693
}
9794

9895
pub fn eq_path_seg(l: &PathSegment, r: &PathSegment) -> bool {
@@ -101,9 +98,7 @@ pub fn eq_path_seg(l: &PathSegment, r: &PathSegment) -> bool {
10198

10299
pub fn eq_generic_args(l: &GenericArgs, r: &GenericArgs) -> bool {
103100
match (l, r) {
104-
(GenericArgs::AngleBracketed(l), GenericArgs::AngleBracketed(r)) => {
105-
over(&l.args, &r.args, |l, r| eq_angle_arg(l, r))
106-
},
101+
(GenericArgs::AngleBracketed(l), GenericArgs::AngleBracketed(r)) => over(&l.args, &r.args, eq_angle_arg),
107102
(GenericArgs::Parenthesized(l), GenericArgs::Parenthesized(r)) => {
108103
over(&l.inputs, &r.inputs, |l, r| eq_ty(l, r)) && eq_fn_ret_ty(&l.output, &r.output)
109104
},
@@ -142,7 +137,7 @@ pub fn eq_struct_rest(l: &StructRest, r: &StructRest) -> bool {
142137

143138
pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
144139
use ExprKind::*;
145-
if !over(&l.attrs, &r.attrs, |l, r| eq_attr(l, r)) {
140+
if !over(&l.attrs, &r.attrs, eq_attr) {
146141
return false;
147142
}
148143
match (&l.kind, &r.kind) {
@@ -173,20 +168,20 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
173168
(Assign(l1, l2, _), Assign(r1, r2, _)) | (Index(l1, l2), Index(r1, r2)) => eq_expr(l1, r1) && eq_expr(l2, r2),
174169
(AssignOp(lo, lp, lv), AssignOp(ro, rp, rv)) => lo.node == ro.node && eq_expr(lp, rp) && eq_expr(lv, rv),
175170
(Field(lp, lf), Field(rp, rf)) => eq_id(*lf, *rf) && eq_expr(lp, rp),
176-
(Match(ls, la), Match(rs, ra)) => eq_expr(ls, rs) && over(la, ra, |l, r| eq_arm(l, r)),
171+
(Match(ls, la), Match(rs, ra)) => eq_expr(ls, rs) && over(la, ra, eq_arm),
177172
(Closure(lc, la, lm, lf, lb, _), Closure(rc, ra, rm, rf, rb, _)) => {
178173
lc == rc && la.is_async() == ra.is_async() && lm == rm && eq_fn_decl(lf, rf) && eq_expr(lb, rb)
179174
},
180175
(Async(lc, _, lb), Async(rc, _, rb)) => lc == rc && eq_block(lb, rb),
181176
(Range(lf, lt, ll), Range(rf, rt, rl)) => ll == rl && eq_expr_opt(lf, rf) && eq_expr_opt(lt, rt),
182177
(AddrOf(lbk, lm, le), AddrOf(rbk, rm, re)) => lbk == rbk && lm == rm && eq_expr(le, re),
183-
(Path(lq, lp), Path(rq, rp)) => both(lq, rq, |l, r| eq_qself(l, r)) && eq_path(lp, rp),
178+
(Path(lq, lp), Path(rq, rp)) => both(lq, rq, eq_qself) && eq_path(lp, rp),
184179
(MacCall(l), MacCall(r)) => eq_mac_call(l, r),
185180
(Struct(lse), Struct(rse)) => {
186181
eq_maybe_qself(&lse.qself, &rse.qself)
187182
&& eq_path(&lse.path, &rse.path)
188183
&& eq_struct_rest(&lse.rest, &rse.rest)
189-
&& unordered_over(&lse.fields, &rse.fields, |l, r| eq_field(l, r))
184+
&& unordered_over(&lse.fields, &rse.fields, eq_field)
190185
},
191186
_ => false,
192187
}
@@ -196,23 +191,23 @@ pub fn eq_field(l: &ExprField, r: &ExprField) -> bool {
196191
l.is_placeholder == r.is_placeholder
197192
&& eq_id(l.ident, r.ident)
198193
&& eq_expr(&l.expr, &r.expr)
199-
&& over(&l.attrs, &r.attrs, |l, r| eq_attr(l, r))
194+
&& over(&l.attrs, &r.attrs, eq_attr)
200195
}
201196

202197
pub fn eq_arm(l: &Arm, r: &Arm) -> bool {
203198
l.is_placeholder == r.is_placeholder
204199
&& eq_pat(&l.pat, &r.pat)
205200
&& eq_expr(&l.body, &r.body)
206201
&& eq_expr_opt(&l.guard, &r.guard)
207-
&& over(&l.attrs, &r.attrs, |l, r| eq_attr(l, r))
202+
&& over(&l.attrs, &r.attrs, eq_attr)
208203
}
209204

210205
pub fn eq_label(l: &Option<Label>, r: &Option<Label>) -> bool {
211206
both(l, r, |l, r| eq_id(l.ident, r.ident))
212207
}
213208

214209
pub fn eq_block(l: &Block, r: &Block) -> bool {
215-
l.rules == r.rules && over(&l.stmts, &r.stmts, |l, r| eq_stmt(l, r))
210+
l.rules == r.rules && over(&l.stmts, &r.stmts, eq_stmt)
216211
}
217212

218213
pub fn eq_stmt(l: &Stmt, r: &Stmt) -> bool {
@@ -222,13 +217,13 @@ pub fn eq_stmt(l: &Stmt, r: &Stmt) -> bool {
222217
eq_pat(&l.pat, &r.pat)
223218
&& both(&l.ty, &r.ty, |l, r| eq_ty(l, r))
224219
&& eq_local_kind(&l.kind, &r.kind)
225-
&& over(&l.attrs, &r.attrs, |l, r| eq_attr(l, r))
220+
&& over(&l.attrs, &r.attrs, eq_attr)
226221
},
227222
(Item(l), Item(r)) => eq_item(l, r, eq_item_kind),
228223
(Expr(l), Expr(r)) | (Semi(l), Semi(r)) => eq_expr(l, r),
229224
(Empty, Empty) => true,
230225
(MacCall(l), MacCall(r)) => {
231-
l.style == r.style && eq_mac_call(&l.mac, &r.mac) && over(&l.attrs, &r.attrs, |l, r| eq_attr(l, r))
226+
l.style == r.style && eq_mac_call(&l.mac, &r.mac) && over(&l.attrs, &r.attrs, eq_attr)
232227
},
233228
_ => false,
234229
}
@@ -245,10 +240,7 @@ pub fn eq_local_kind(l: &LocalKind, r: &LocalKind) -> bool {
245240
}
246241

247242
pub fn eq_item<K>(l: &Item<K>, r: &Item<K>, mut eq_kind: impl FnMut(&K, &K) -> bool) -> bool {
248-
eq_id(l.ident, r.ident)
249-
&& over(&l.attrs, &r.attrs, |l, r| eq_attr(l, r))
250-
&& eq_vis(&l.vis, &r.vis)
251-
&& eq_kind(&l.kind, &r.kind)
243+
eq_id(l.ident, r.ident) && over(&l.attrs, &r.attrs, eq_attr) && eq_vis(&l.vis, &r.vis) && eq_kind(&l.kind, &r.kind)
252244
}
253245

254246
pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
@@ -272,29 +264,26 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
272264
}
273265
},
274266
(ForeignMod(l), ForeignMod(r)) => {
275-
both(&l.abi, &r.abi, |l, r| eq_str_lit(l, r))
276-
&& over(&l.items, &r.items, |l, r| eq_item(l, r, eq_foreign_item_kind))
267+
both(&l.abi, &r.abi, eq_str_lit) && over(&l.items, &r.items, |l, r| eq_item(l, r, eq_foreign_item_kind))
277268
},
278269
(TyAlias(box TyAliasKind(ld, lg, lb, lt)), TyAlias(box TyAliasKind(rd, rg, rb, rt))) => {
279270
eq_defaultness(*ld, *rd)
280271
&& eq_generics(lg, rg)
281-
&& over(lb, rb, |l, r| eq_generic_bound(l, r))
272+
&& over(lb, rb, eq_generic_bound)
282273
&& both(lt, rt, |l, r| eq_ty(l, r))
283274
},
284-
(Enum(le, lg), Enum(re, rg)) => {
285-
over(&le.variants, &re.variants, |l, r| eq_variant(l, r)) && eq_generics(lg, rg)
286-
},
275+
(Enum(le, lg), Enum(re, rg)) => over(&le.variants, &re.variants, eq_variant) && eq_generics(lg, rg),
287276
(Struct(lv, lg), Struct(rv, rg)) | (Union(lv, lg), Union(rv, rg)) => {
288277
eq_variant_data(lv, rv) && eq_generics(lg, rg)
289278
},
290279
(Trait(box TraitKind(la, lu, lg, lb, li)), Trait(box TraitKind(ra, ru, rg, rb, ri))) => {
291280
la == ra
292281
&& matches!(lu, Unsafe::No) == matches!(ru, Unsafe::No)
293282
&& eq_generics(lg, rg)
294-
&& over(lb, rb, |l, r| eq_generic_bound(l, r))
283+
&& over(lb, rb, eq_generic_bound)
295284
&& over(li, ri, |l, r| eq_item(l, r, eq_assoc_item_kind))
296285
},
297-
(TraitAlias(lg, lb), TraitAlias(rg, rb)) => eq_generics(lg, rg) && over(lb, rb, |l, r| eq_generic_bound(l, r)),
286+
(TraitAlias(lg, lb), TraitAlias(rg, rb)) => eq_generics(lg, rg) && over(lb, rb, eq_generic_bound),
298287
(
299288
Impl(box ImplKind {
300289
unsafety: lu,
@@ -342,7 +331,7 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
342331
(TyAlias(box TyAliasKind(ld, lg, lb, lt)), TyAlias(box TyAliasKind(rd, rg, rb, rt))) => {
343332
eq_defaultness(*ld, *rd)
344333
&& eq_generics(lg, rg)
345-
&& over(lb, rb, |l, r| eq_generic_bound(l, r))
334+
&& over(lb, rb, eq_generic_bound)
346335
&& both(lt, rt, |l, r| eq_ty(l, r))
347336
},
348337
(MacCall(l), MacCall(r)) => eq_mac_call(l, r),
@@ -360,7 +349,7 @@ pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
360349
(TyAlias(box TyAliasKind(ld, lg, lb, lt)), TyAlias(box TyAliasKind(rd, rg, rb, rt))) => {
361350
eq_defaultness(*ld, *rd)
362351
&& eq_generics(lg, rg)
363-
&& over(lb, rb, |l, r| eq_generic_bound(l, r))
352+
&& over(lb, rb, eq_generic_bound)
364353
&& both(lt, rt, |l, r| eq_ty(l, r))
365354
},
366355
(MacCall(l), MacCall(r)) => eq_mac_call(l, r),
@@ -370,7 +359,7 @@ pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
370359

371360
pub fn eq_variant(l: &Variant, r: &Variant) -> bool {
372361
l.is_placeholder == r.is_placeholder
373-
&& over(&l.attrs, &r.attrs, |l, r| eq_attr(l, r))
362+
&& over(&l.attrs, &r.attrs, eq_attr)
374363
&& eq_vis(&l.vis, &r.vis)
375364
&& eq_id(l.ident, r.ident)
376365
&& eq_variant_data(&l.data, &r.data)
@@ -381,14 +370,14 @@ pub fn eq_variant_data(l: &VariantData, r: &VariantData) -> bool {
381370
use VariantData::*;
382371
match (l, r) {
383372
(Unit(_), Unit(_)) => true,
384-
(Struct(l, _), Struct(r, _)) | (Tuple(l, _), Tuple(r, _)) => over(l, r, |l, r| eq_struct_field(l, r)),
373+
(Struct(l, _), Struct(r, _)) | (Tuple(l, _), Tuple(r, _)) => over(l, r, eq_struct_field),
385374
_ => false,
386375
}
387376
}
388377

389378
pub fn eq_struct_field(l: &FieldDef, r: &FieldDef) -> bool {
390379
l.is_placeholder == r.is_placeholder
391-
&& over(&l.attrs, &r.attrs, |l, r| eq_attr(l, r))
380+
&& over(&l.attrs, &r.attrs, eq_attr)
392381
&& eq_vis(&l.vis, &r.vis)
393382
&& both(&l.ident, &r.ident, |l, r| eq_id(*l, *r))
394383
&& eq_ty(&l.ty, &r.ty)
@@ -406,7 +395,7 @@ pub fn eq_fn_header(l: &FnHeader, r: &FnHeader) -> bool {
406395
}
407396

408397
pub fn eq_generics(l: &Generics, r: &Generics) -> bool {
409-
over(&l.params, &r.params, |l, r| eq_generic_param(l, r))
398+
over(&l.params, &r.params, eq_generic_param)
410399
&& over(&l.where_clause.predicates, &r.where_clause.predicates, |l, r| {
411400
eq_where_predicate(l, r)
412401
})
@@ -419,10 +408,10 @@ pub fn eq_where_predicate(l: &WherePredicate, r: &WherePredicate) -> bool {
419408
over(&l.bound_generic_params, &r.bound_generic_params, |l, r| {
420409
eq_generic_param(l, r)
421410
}) && eq_ty(&l.bounded_ty, &r.bounded_ty)
422-
&& over(&l.bounds, &r.bounds, |l, r| eq_generic_bound(l, r))
411+
&& over(&l.bounds, &r.bounds, eq_generic_bound)
423412
},
424413
(RegionPredicate(l), RegionPredicate(r)) => {
425-
eq_id(l.lifetime.ident, r.lifetime.ident) && over(&l.bounds, &r.bounds, |l, r| eq_generic_bound(l, r))
414+
eq_id(l.lifetime.ident, r.lifetime.ident) && over(&l.bounds, &r.bounds, eq_generic_bound)
426415
},
427416
(EqPredicate(l), EqPredicate(r)) => eq_ty(&l.lhs_ty, &r.lhs_ty) && eq_ty(&l.rhs_ty, &r.rhs_ty),
428417
_ => false,
@@ -469,7 +458,7 @@ pub fn eq_fn_decl(l: &FnDecl, r: &FnDecl) -> bool {
469458
l.is_placeholder == r.is_placeholder
470459
&& eq_pat(&l.pat, &r.pat)
471460
&& eq_ty(&l.ty, &r.ty)
472-
&& over(&l.attrs, &r.attrs, |l, r| eq_attr(l, r))
461+
&& over(&l.attrs, &r.attrs, eq_attr)
473462
})
474463
}
475464

@@ -496,13 +485,13 @@ pub fn eq_ty(l: &Ty, r: &Ty) -> bool {
496485
(BareFn(l), BareFn(r)) => {
497486
l.unsafety == r.unsafety
498487
&& eq_ext(&l.ext, &r.ext)
499-
&& over(&l.generic_params, &r.generic_params, |l, r| eq_generic_param(l, r))
488+
&& over(&l.generic_params, &r.generic_params, eq_generic_param)
500489
&& eq_fn_decl(&l.decl, &r.decl)
501490
},
502491
(Tup(l), Tup(r)) => over(l, r, |l, r| eq_ty(l, r)),
503-
(Path(lq, lp), Path(rq, rp)) => both(lq, rq, |l, r| eq_qself(l, r)) && eq_path(lp, rp),
504-
(TraitObject(lg, ls), TraitObject(rg, rs)) => ls == rs && over(lg, rg, |l, r| eq_generic_bound(l, r)),
505-
(ImplTrait(_, lg), ImplTrait(_, rg)) => over(lg, rg, |l, r| eq_generic_bound(l, r)),
492+
(Path(lq, lp), Path(rq, rp)) => both(lq, rq, eq_qself) && eq_path(lp, rp),
493+
(TraitObject(lg, ls), TraitObject(rg, rs)) => ls == rs && over(lg, rg, eq_generic_bound),
494+
(ImplTrait(_, lg), ImplTrait(_, rg)) => over(lg, rg, eq_generic_bound),
506495
(Typeof(l), Typeof(r)) => eq_expr(&l.value, &r.value),
507496
(MacCall(l), MacCall(r)) => eq_mac_call(l, r),
508497
_ => false,
@@ -533,7 +522,7 @@ pub fn eq_generic_param(l: &GenericParam, r: &GenericParam) -> bool {
533522
use GenericParamKind::*;
534523
l.is_placeholder == r.is_placeholder
535524
&& eq_id(l.ident, r.ident)
536-
&& over(&l.bounds, &r.bounds, |l, r| eq_generic_bound(l, r))
525+
&& over(&l.bounds, &r.bounds, eq_generic_bound)
537526
&& match (&l.kind, &r.kind) {
538527
(Lifetime, Lifetime) => true,
539528
(Type { default: l }, Type { default: r }) => both(l, r, |l, r| eq_ty(l, r)),
@@ -548,10 +537,10 @@ pub fn eq_generic_param(l: &GenericParam, r: &GenericParam) -> bool {
548537
kw_span: _,
549538
default: rd,
550539
},
551-
) => eq_ty(lt, rt) && both(ld, rd, |ld, rd| eq_anon_const(ld, rd)),
540+
) => eq_ty(lt, rt) && both(ld, rd, eq_anon_const),
552541
_ => false,
553542
}
554-
&& over(&l.attrs, &r.attrs, |l, r| eq_attr(l, r))
543+
&& over(&l.attrs, &r.attrs, eq_attr)
555544
}
556545

557546
pub fn eq_generic_bound(l: &GenericBound, r: &GenericBound) -> bool {
@@ -568,7 +557,7 @@ pub fn eq_assoc_constraint(l: &AssocTyConstraint, r: &AssocTyConstraint) -> bool
568557
eq_id(l.ident, r.ident)
569558
&& match (&l.kind, &r.kind) {
570559
(Equality { ty: l }, Equality { ty: r }) => eq_ty(l, r),
571-
(Bound { bounds: l }, Bound { bounds: r }) => over(l, r, |l, r| eq_generic_bound(l, r)),
560+
(Bound { bounds: l }, Bound { bounds: r }) => over(l, r, eq_generic_bound),
572561
_ => false,
573562
}
574563
}

clippy_utils/src/eager_or_lazy.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ fn identify_some_pure_patterns(expr: &Expr<'_>) -> bool {
2727
match expr.kind {
2828
ExprKind::Lit(..) | ExprKind::ConstBlock(..) | ExprKind::Path(..) | ExprKind::Field(..) => true,
2929
ExprKind::AddrOf(_, _, addr_of_expr) => identify_some_pure_patterns(addr_of_expr),
30-
ExprKind::Tup(tup_exprs) => tup_exprs.iter().all(|expr| identify_some_pure_patterns(expr)),
30+
ExprKind::Tup(tup_exprs) => tup_exprs.iter().all(identify_some_pure_patterns),
3131
ExprKind::Struct(_, fields, expr) => {
32-
fields.iter().all(|f| identify_some_pure_patterns(f.expr))
33-
&& expr.map_or(true, |e| identify_some_pure_patterns(e))
32+
fields.iter().all(|f| identify_some_pure_patterns(f.expr)) && expr.map_or(true, identify_some_pure_patterns)
3433
},
3534
ExprKind::Call(
3635
&Expr {
@@ -45,7 +44,7 @@ fn identify_some_pure_patterns(expr: &Expr<'_>) -> bool {
4544
..
4645
},
4746
args,
48-
) => args.iter().all(|expr| identify_some_pure_patterns(expr)),
47+
) => args.iter().all(identify_some_pure_patterns),
4948
ExprKind::Block(
5049
&Block {
5150
stmts,

0 commit comments

Comments
 (0)