Skip to content

Commit 6b10b43

Browse files
committed
iter_without_into_iter: Delay macro check
1 parent fa1a690 commit 6b10b43

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_lints/src/iter_without_into_iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ fn is_ty_exported(cx: &LateContext<'_>, ty: Ty<'_>) -> bool {
125125

126126
impl LateLintPass<'_> for IterWithoutIntoIter {
127127
fn check_item(&mut self, cx: &LateContext<'_>, item: &rustc_hir::Item<'_>) {
128-
if !in_external_macro(cx.sess(), item.span)
129-
&& let ItemKind::Impl(imp) = item.kind
128+
if let ItemKind::Impl(imp) = item.kind
130129
&& let TyKind::Ref(_, self_ty_without_ref) = &imp.self_ty.kind
131130
&& let Some(trait_ref) = imp.of_trait
132131
&& trait_ref
133132
.trait_def_id()
134133
.is_some_and(|did| cx.tcx.is_diagnostic_item(sym::IntoIterator, did))
134+
&& !in_external_macro(cx.sess(), item.span)
135135
&& let &ty::Ref(_, ty, mtbl) = cx.tcx.type_of(item.owner_id).instantiate_identity().kind()
136136
&& let expected_method_name = match mtbl {
137137
Mutability::Mut => sym::iter_mut,

0 commit comments

Comments
 (0)