Skip to content

Commit 89a848c

Browse files
committed
Fix fmt and dogfood lints for never_loop iterator reduction
1 parent 36201bd commit 89a848c

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

clippy_lints/src/loops/mod.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -893,13 +893,7 @@ impl<'tcx> LateLintPass<'tcx> for Loops {
893893
if let ExprKind::MethodCall(path, recv, args, _) = expr.kind
894894
&& matches!(
895895
path.ident.name,
896-
sym::for_each
897-
| sym::try_for_each
898-
| sym::fold
899-
| sym::try_fold
900-
| sym::reduce
901-
| sym::all
902-
| sym::any
896+
sym::for_each | sym::try_for_each | sym::fold | sym::try_fold | sym::reduce | sym::all | sym::any
903897
)
904898
&& ty::get_iterator_item_ty(cx, cx.typeck_results().expr_ty(recv)).is_some()
905899
{

clippy_lints/src/loops/never_loop.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub(super) fn check_iterator_reduction<'tcx>(
8888
};
8989

9090
let closure_arg = match method_name {
91-
sym::for_each | sym::try_for_each | sym::reduce | sym::all | sym::any => args.get(0),
91+
sym::for_each | sym::try_for_each | sym::reduce | sym::all | sym::any => args.first(),
9292
sym::fold | sym::try_fold => args.get(1),
9393
_ => None,
9494
};
@@ -118,7 +118,6 @@ pub(super) fn check_iterator_reduction<'tcx>(
118118
diag.span_suggestion_verbose(expr.span, "consider this pattern", sugg, app);
119119
},
120120
);
121-
return;
122121
}
123122
}
124123

clippy_utils/src/sym.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ generate! {
6666
Regex,
6767
RegexBuilder,
6868
RegexSet,
69-
reduce,
7069
Start,
7170
Symbol,
7271
SyntaxContext,
@@ -276,6 +275,7 @@ generate! {
276275
read_to_string,
277276
read_unaligned,
278277
read_volatile,
278+
reduce,
279279
redundant_imports,
280280
redundant_pub_crate,
281281
regex,

0 commit comments

Comments
 (0)