Change a category of excessive_for_each: Style -> Restriction

This commit is contained in:
Yoshitomo Nakanishi 2021-02-09 23:36:20 +09:00
parent 30952530c5
commit 54a04711ed
3 changed files with 2 additions and 4 deletions

View File

@ -1314,6 +1314,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&matches::WILDCARD_ENUM_MATCH_ARM),
LintId::of(&mem_forget::MEM_FORGET),
LintId::of(&methods::CLONE_ON_REF_PTR),
LintId::of(&methods::EXCESSIVE_FOR_EACH),
LintId::of(&methods::EXPECT_USED),
LintId::of(&methods::FILETYPE_IS_FILE),
LintId::of(&methods::GET_UNWRAP),
@ -1582,7 +1583,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&methods::CHARS_NEXT_CMP),
LintId::of(&methods::CLONE_DOUBLE_REF),
LintId::of(&methods::CLONE_ON_COPY),
LintId::of(&methods::EXCESSIVE_FOR_EACH),
LintId::of(&methods::EXPECT_FUN_CALL),
LintId::of(&methods::FILTER_MAP_IDENTITY),
LintId::of(&methods::FILTER_NEXT),
@ -1799,7 +1799,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&methods::BYTES_NTH),
LintId::of(&methods::CHARS_LAST_CMP),
LintId::of(&methods::CHARS_NEXT_CMP),
LintId::of(&methods::EXCESSIVE_FOR_EACH),
LintId::of(&methods::FROM_ITER_INSTEAD_OF_COLLECT),
LintId::of(&methods::INTO_ITER_ON_REF),
LintId::of(&methods::ITER_CLONED_COLLECT),

View File

@ -26,7 +26,6 @@ pub(super) fn lint(cx: &LateContext<'_>, expr: &'tcx Expr<'_>, args: &[&[Expr<'_
if_chain! {
if match_trait_method(cx, expr, &paths::ITERATOR);
if !match_trait_method(cx, for_each_receiver, &paths::ITERATOR);
if is_target_ty(cx, cx.typeck_results().expr_ty(iter_receiver));
if let ExprKind::Closure(_, _, body_id, ..) = for_each_arg.kind;
then {

View File

@ -997,7 +997,7 @@ declare_clippy_lint! {
/// }
/// ```
pub EXCESSIVE_FOR_EACH,
style,
restriction,
"using `.iter().for_each(|x| {..})` when using `for` loop would work instead"
}