Skip to content

Commit c64f1e3

Browse files
committed
Fix lint_without_lint_pass internal lint
1 parent 4f12b98 commit c64f1e3

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ declare_clippy_lint! {
2121
///
2222
/// ### Why is this bad?
2323
/// The compiler only knows lints via a `LintPass`. Without
24-
/// putting a lint to a `LintPass::get_lints()`'s return, the compiler will not
24+
/// putting a lint to a `LintPass::lint_vec()`'s return, the compiler will not
2525
/// know the name of the lint.
2626
///
2727
/// ### Known problems
@@ -159,8 +159,8 @@ impl<'tcx> LateLintPass<'tcx> for LintWithoutLintPass {
159159
let body = cx.tcx.hir().body_owned_by(
160160
impl_item_refs
161161
.iter()
162-
.find(|iiref| iiref.ident.as_str() == "get_lints")
163-
.expect("LintPass needs to implement get_lints")
162+
.find(|iiref| iiref.ident.as_str() == "lint_vec")
163+
.expect("LintPass needs to implement lint_vec")
164164
.id
165165
.owner_id
166166
.def_id,

‎tests/ui-internal/lint_without_lint_pass.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extern crate rustc_middle;
77
#[macro_use]
88
externcrate rustc_session;
99
externcrate rustc_lint;
10-
use rustc_lint::LintPass;
10+
use rustc_lint::{LintPass,LintVec};
1111

1212
declare_tool_lint!{
1313
pub clippy::TEST_LINT,
@@ -35,6 +35,9 @@ impl LintPass for Pass {
3535
fnname(&self) -> &'staticstr{
3636
"TEST_LINT"
3737
}
38+
fnget_lints(&self) -> LintVec{
39+
vec![TEST_LINT]
40+
}
3841
}
3942

4043
declare_lint_pass!(Pass2 => [TEST_LINT_REGISTERED]);

0 commit comments

Comments
 (0)