From a77a1b0eaf0b1892e877b0477b4fde75ed1f89d0 Mon Sep 17 00:00:00 2001 From: Philippe-Cholet <44676486+Philippe-Cholet@users.noreply.github.com> Date: Mon, 29 Jan 2024 12:46:08 +0100 Subject: [PATCH] Ignore if `in_external_macro` --- clippy_lints/src/missing_iterator_fold.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clippy_lints/src/missing_iterator_fold.rs b/clippy_lints/src/missing_iterator_fold.rs index d702b9bb627e..05e38ce12f97 100644 --- a/clippy_lints/src/missing_iterator_fold.rs +++ b/clippy_lints/src/missing_iterator_fold.rs @@ -1,6 +1,6 @@ use clippy_utils::diagnostics::span_lint; use rustc_hir::{AssocItemKind, Impl, Item, ItemKind}; -use rustc_lint::{LateContext, LateLintPass}; +use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::declare_lint_pass; use rustc_span::sym; @@ -53,6 +53,9 @@ declare_lint_pass!(MissingIteratorFold => [MISSING_ITERATOR_FOLD]); impl LateLintPass<'_> for MissingIteratorFold { fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) { + if rustc_middle::lint::in_external_macro(cx.sess(), item.span) { + return; + } if let ItemKind::Impl(Impl { of_trait: Some(trait_ref), ..