Skip to content

Commit ce87051

Browse files
flip1995kraai
authored andcommitted
Fix lint_without_lint_pass internal lint
1 parent 3e760cc commit ce87051

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
@@ -150,7 +150,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
150150
output: &mut self.registered_lints,
151151
cx,
152152
};
153-
let body_id = cx.tcx.hir().body_owned_by(impl_item_refs[0].id.hir_id);
153+
let body_id = cx.tcx.hir().body_owned_by(
154+
impl_item_refs
155+
.iter()
156+
.find(|iiref| iiref.ident.as_str() == "get_lints")
157+
.expect("LintPass needs to implement get_lints")
158+
.id.hir_id
159+
);
154160
collector.visit_expr(&cx.tcx.hir().body(body_id).value);
155161
}
156162
}

0 commit comments

Comments
 (0)