Fix test fallout
This commit is contained in:
parent
dab3bd6cda
commit
b761367d52
6 changed files with 31 additions and 28 deletions
|
|
@ -15,15 +15,14 @@ use syntax::symbol::Symbol;
|
|||
|
||||
use rustc::hir;
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::hir::map as hir_map;
|
||||
use hir::Node;
|
||||
use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext};
|
||||
use rustc::ty;
|
||||
use syntax::{ast, source_map};
|
||||
use syntax::source_map;
|
||||
|
||||
#[plugin_registrar]
|
||||
pub fn plugin_registrar(reg: &mut Registry) {
|
||||
reg.register_late_lint_pass(box MissingWhitelistedAttrPass);
|
||||
reg.lint_store.register_lints(&[&MISSING_WHITELISTED_ATTR]);
|
||||
reg.lint_store.register_late_pass(|| box MissingWhitelistedAttrPass);
|
||||
reg.register_attribute(Symbol::intern("whitelisted_attr"), Whitelisted);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,24 +7,20 @@
|
|||
extern crate rustc_driver;
|
||||
extern crate syntax;
|
||||
|
||||
use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
|
||||
use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass};
|
||||
use rustc_driver::plugin::Registry;
|
||||
use rustc::hir;
|
||||
use syntax::attr;
|
||||
use syntax::symbol::Symbol;
|
||||
|
||||
macro_rules! fake_lint_pass {
|
||||
($struct:ident, $lints:expr, $($attr:expr),*) => {
|
||||
($struct:ident, $($attr:expr),*) => {
|
||||
struct $struct;
|
||||
|
||||
impl LintPass for $struct {
|
||||
fn name(&self) -> &'static str {
|
||||
stringify!($struct)
|
||||
}
|
||||
|
||||
fn get_lints(&self) -> LintArray {
|
||||
$lints
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for $struct {
|
||||
|
|
@ -49,25 +45,29 @@ declare_lint!(CRATE_NOT_GREEN, Warn, "crate not marked with #![crate_green]");
|
|||
|
||||
fake_lint_pass! {
|
||||
PassOkay,
|
||||
lint_array!(CRATE_NOT_OKAY), // Single lint
|
||||
Symbol::intern("rustc_crate_okay")
|
||||
}
|
||||
|
||||
fake_lint_pass! {
|
||||
PassRedBlue,
|
||||
lint_array!(CRATE_NOT_RED, CRATE_NOT_BLUE), // Multiple lints
|
||||
Symbol::intern("rustc_crate_red"), Symbol::intern("rustc_crate_blue")
|
||||
}
|
||||
|
||||
fake_lint_pass! {
|
||||
PassGreyGreen,
|
||||
lint_array!(CRATE_NOT_GREY, CRATE_NOT_GREEN, ), // Trailing comma
|
||||
Symbol::intern("rustc_crate_grey"), Symbol::intern("rustc_crate_green")
|
||||
}
|
||||
|
||||
#[plugin_registrar]
|
||||
pub fn plugin_registrar(reg: &mut Registry) {
|
||||
reg.register_late_lint_pass(box PassOkay);
|
||||
reg.register_late_lint_pass(box PassRedBlue);
|
||||
reg.register_late_lint_pass(box PassGreyGreen);
|
||||
reg.lint_store.register_lints(&[
|
||||
&CRATE_NOT_OKAY,
|
||||
&CRATE_NOT_RED,
|
||||
&CRATE_NOT_BLUE,
|
||||
&CRATE_NOT_GREY,
|
||||
&CRATE_NOT_GREEN,
|
||||
]);
|
||||
reg.lint_store.register_late_pass(|| box PassOkay);
|
||||
reg.lint_store.register_late_pass(|| box PassRedBlue);
|
||||
reg.lint_store.register_late_pass(|| box PassGreyGreen);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
extern crate rustc_driver;
|
||||
extern crate syntax;
|
||||
|
||||
use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
|
||||
use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LintArray};
|
||||
use rustc_driver::plugin::Registry;
|
||||
use rustc::hir;
|
||||
use syntax::attr;
|
||||
|
|
@ -32,6 +32,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||
|
||||
#[plugin_registrar]
|
||||
pub fn plugin_registrar(reg: &mut Registry) {
|
||||
reg.register_lint(&[&CRATE_NOT_OKAY]);
|
||||
reg.register_late_lint_pass(|| box Pass);
|
||||
reg.lint_store.register_lints(&[&CRATE_NOT_OKAY]);
|
||||
reg.lint_store.register_late_pass(|| box Pass);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ extern crate rustc;
|
|||
extern crate rustc_driver;
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
|
||||
use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LintArray, LintId};
|
||||
use rustc_driver::plugin::Registry;
|
||||
|
||||
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
|
||||
|
|
@ -30,6 +30,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||
|
||||
#[plugin_registrar]
|
||||
pub fn plugin_registrar(reg: &mut Registry) {
|
||||
reg.register_late_lint_pass(box Pass);
|
||||
reg.register_lint_group("lint_me", None, vec![TEST_LINT, PLEASE_LINT]);
|
||||
reg.lint_store.register_lints(&[&TEST_LINT, &PLEASE_LINT]);
|
||||
reg.lint_store.register_late_pass(|| box Pass);
|
||||
reg.lint_store.register_group(true, "lint_me", None,
|
||||
vec![LintId::of(&TEST_LINT), LintId::of(&PLEASE_LINT)]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ extern crate syntax;
|
|||
extern crate rustc;
|
||||
extern crate rustc_driver;
|
||||
|
||||
use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass,
|
||||
EarlyLintPassObject, LintArray};
|
||||
use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass, LintArray};
|
||||
use rustc_driver::plugin::Registry;
|
||||
use syntax::ast;
|
||||
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
|
||||
|
|
@ -28,5 +27,6 @@ impl EarlyLintPass for Pass {
|
|||
|
||||
#[plugin_registrar]
|
||||
pub fn plugin_registrar(reg: &mut Registry) {
|
||||
reg.register_early_lint_pass(box Pass as EarlyLintPassObject);
|
||||
reg.lint_store.register_lints(&[&TEST_LINT]);
|
||||
reg.lint_store.register_early_pass(|| box Pass);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ extern crate syntax;
|
|||
extern crate rustc;
|
||||
extern crate rustc_driver;
|
||||
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass, LintId};
|
||||
use rustc_driver::plugin::Registry;
|
||||
use syntax::ast;
|
||||
declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff");
|
||||
|
|
@ -40,6 +40,8 @@ impl EarlyLintPass for Pass {
|
|||
|
||||
#[plugin_registrar]
|
||||
pub fn plugin_registrar(reg: &mut Registry) {
|
||||
reg.register_early_lint_pass(box Pass);
|
||||
reg.register_lint_group("clippy::group", Some("clippy_group"), vec![TEST_LINT, TEST_GROUP]);
|
||||
reg.lint_store.register_lints(&[&TEST_RUSTC_TOOL_LINT, &TEST_LINT, &TEST_GROUP]);
|
||||
reg.lint_store.register_early_pass(|| box Pass);
|
||||
reg.lint_store.register_group(true, "clippy::group", Some("clippy_group"),
|
||||
vec![LintId::of(&TEST_LINT), LintId::of(&TEST_GROUP)]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue