Skip to content

Commit 87ab2e6

Browse files
committed
Fix lint_without_lint_pass internal lint
1 parent 17e04ac commit 87ab2e6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

clippy_lints/src/utils/internal_lints.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
164164
output: &mut self.registered_lints,
165165
cx,
166166
};
167-
let body_id = cx.tcx.hir().body_owned_by(impl_item_refs[0].id.hir_id);
167+
let body_id = cx.tcx.hir().body_owned_by(
168+
impl_item_refs
169+
.iter()
170+
.find(|iiref| iiref.ident.as_str() == "get_lints")
171+
.expect("LintPass needs to implement get_lints")
172+
.id.hir_id
173+
);
168174
collector.visit_expr(&cx.tcx.hir().body(body_id).value);
169175
}
170176
}

0 commit comments

Comments
 (0)