diff --git a/clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs b/clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs index ed119aa46ca..af38e066559 100644 --- a/clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs +++ b/clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs @@ -21,7 +21,7 @@ /// /// ### Why is this bad? /// The compiler only knows lints via a `LintPass`. Without - /// putting a lint to a `LintPass::get_lints()`'s return, the compiler will not + /// putting a lint to a `LintPass::lint_vec()`'s return, the compiler will not /// know the name of the lint. /// /// ### Known problems @@ -159,8 +159,8 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) { 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, diff --git a/tests/ui-internal/lint_without_lint_pass.rs b/tests/ui-internal/lint_without_lint_pass.rs index 1fd03cfe36d..d59e9cbbb61 100644 --- a/tests/ui-internal/lint_without_lint_pass.rs +++ b/tests/ui-internal/lint_without_lint_pass.rs @@ -7,7 +7,7 @@ #[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, @@ -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]);