Skip to content

Commit

Permalink
Fix lint_without_lint_pass internal lint
Browse files Browse the repository at this point in the history
  • Loading branch information
flip1995 committed Nov 3, 2024
1 parent b99277f commit 57c9d0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ impl<'tcx> LateLintPass<'tcx> for LintWithoutLintPass {
let body = cx.tcx.hir().body_owned_by(
impl_item_refs
.iter()
.find(|iiref| iiref.ident.as_str() == "get_lints")
.expect("LintPass needs to implement get_lints")
.find(|iiref| iiref.ident.as_str() == "lint_vec")
.expect("LintPass needs to implement lint_vec")
.id
.owner_id
.def_id,
Expand Down
5 changes: 4 additions & 1 deletion tests/ui-internal/lint_without_lint_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extern crate rustc_middle;
#[macro_use]
extern crate rustc_session;
extern crate rustc_lint;
use rustc_lint::LintPass;
use rustc_lint::{LintPass, LintVec};

declare_tool_lint! {
pub clippy::TEST_LINT,
Expand Down Expand Up @@ -35,6 +35,9 @@ impl LintPass for Pass {
fn name(&self) -> &'static str {
"TEST_LINT"
}
fn get_lints(&self) -> LintVec {
vec![TEST_LINT]
}
}

declare_lint_pass!(Pass2 => [TEST_LINT_REGISTERED]);
Expand Down

0 comments on commit 57c9d0a

Please sign in to comment.