Skip to content

Commit 7fbdd8e

Browse files
committed
Change a category of excessive_for_each: Style -> Restriction
1 parent 7acb8f8 commit 7fbdd8e

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

clippy_lints/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
12801280
LintId::of(&matches::WILDCARD_ENUM_MATCH_ARM),
12811281
LintId::of(&mem_forget::MEM_FORGET),
12821282
LintId::of(&methods::CLONE_ON_REF_PTR),
1283+
LintId::of(&methods::EXCESSIVE_FOR_EACH),
12831284
LintId::of(&methods::EXPECT_USED),
12841285
LintId::of(&methods::FILETYPE_IS_FILE),
12851286
LintId::of(&methods::GET_UNWRAP),
@@ -1536,7 +1537,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15361537
LintId::of(&methods::CHARS_NEXT_CMP),
15371538
LintId::of(&methods::CLONE_DOUBLE_REF),
15381539
LintId::of(&methods::CLONE_ON_COPY),
1539-
LintId::of(&methods::EXCESSIVE_FOR_EACH),
15401540
LintId::of(&methods::EXPECT_FUN_CALL),
15411541
LintId::of(&methods::FILTER_MAP_IDENTITY),
15421542
LintId::of(&methods::FILTER_NEXT),
@@ -1753,7 +1753,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
17531753
LintId::of(&mem_replace::MEM_REPLACE_WITH_DEFAULT),
17541754
LintId::of(&methods::CHARS_LAST_CMP),
17551755
LintId::of(&methods::CHARS_NEXT_CMP),
1756-
LintId::of(&methods::EXCESSIVE_FOR_EACH),
17571756
LintId::of(&methods::FROM_ITER_INSTEAD_OF_COLLECT),
17581757
LintId::of(&methods::INTO_ITER_ON_REF),
17591758
LintId::of(&methods::ITER_CLONED_COLLECT),

clippy_lints/src/methods/excessive_for_each.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub(super) fn lint(cx: &LateContext<'_>, expr: &'tcx Expr<'_>, args: &[&[Expr<'_
2626

2727
if_chain! {
2828
if match_trait_method(cx, expr, &paths::ITERATOR);
29-
if !match_trait_method(cx, for_each_receiver, &paths::ITERATOR);
3029
if is_target_ty(cx, cx.typeck_results().expr_ty(iter_receiver));
3130
if let ExprKind::Closure(_, _, body_id, ..) = for_each_arg.kind;
3231
then {

clippy_lints/src/methods/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ declare_clippy_lint! {
951951
/// }
952952
/// ```
953953
pub EXCESSIVE_FOR_EACH,
954-
style,
954+
restriction,
955955
"using `.iter().for_each(|x| {..})` when using `for` loop would work instead"
956956
}
957957

0 commit comments

Comments
 (0)