Fix lint_without_lint_pass internal lint
This commit is contained in:
parent
4f12b98654
commit
c64f1e3591
@ -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,
|
||||
|
@ -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]);
|
||||
|
Loading…
Reference in New Issue
Block a user