about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2024-11-03 14:25:46 +0100
committerPhilipp Krones <hello@philkrones.com>2024-11-07 17:27:46 +0100
commitc64f1e359192473acb38b2ac33aa98055f373405 (patch)
tree8946ca63a319ff174868358ff1c8375f61a78dc8
parent4f12b986547667474b33b2cc4d6d27226d22e4b4 (diff)
downloadrust-c64f1e359192473acb38b2ac33aa98055f373405.tar.gz
rust-c64f1e359192473acb38b2ac33aa98055f373405.zip
Fix lint_without_lint_pass internal lint
-rw-r--r--clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs6
-rw-r--r--tests/ui-internal/lint_without_lint_pass.rs5
2 files changed, 7 insertions, 4 deletions
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 @@ declare_clippy_lint! {
     ///
     /// ### 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 @@ 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,
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 @@ 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,
@@ -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]);