use rustc_plugin::Registry;
use syntax::ast;
declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff");
+declare_tool_lint!(pub clippy::TEST_GROUP, Warn, "Warn about other stuff");
struct Pass;
impl LintPass for Pass {
fn get_lints(&self) -> LintArray {
- lint_array!(TEST_LINT)
+ lint_array!(TEST_LINT, TEST_GROUP)
}
}
if it.ident.name == "lintme" {
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
}
+ if it.ident.name == "lintmetoo" {
+ cx.span_lint(TEST_GROUP, it.span, "item is named 'lintmetoo'");
+ }
}
}
#[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]);
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// run-pass
// aux-build:lint_tool_test.rs
// ignore-stage1
#![feature(plugin)]
#![feature(tool_lints)]
#![plugin(lint_tool_test)]
#![allow(dead_code)]
+#![deny(clippy_group)]
+//~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
-fn lintme() { } //~ WARNING item is named 'lintme'
+fn lintme() { } //~ ERROR item is named 'lintme'
+
+#[allow(clippy::group)]
+fn lintmetoo() {}
#[allow(clippy::test_lint)]
pub fn main() {
fn lintme() { }
+ fn lintmetoo() { } //~ ERROR item is named 'lintmetoo'
+}
+
+#[allow(test_group)]
+//~^ WARNING lint name `test_group` is deprecated and may not have an effect in the future
+#[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist`
+fn hello() {
+ fn lintmetoo() { }
}
-warning: item is named 'lintme'
- --> $DIR/lint_tool_test.rs:19:1
+warning: lint name `clippy_group` is deprecated and may not have an effect in the future
+ --> $DIR/lint_tool_test.rs:17:9
|
-LL | fn lintme() { } //~ WARNING item is named 'lintme'
+LL | #![deny(clippy_group)]
+ | ^^^^^^^^^^^^ help: change it to: `clippy::group`
+ |
+ = note: #[warn(renamed_and_removed_lints)] on by default
+
+warning: lint name `test_group` is deprecated and may not have an effect in the future
+ --> $DIR/lint_tool_test.rs:31:9
+ |
+LL | #[allow(test_group)]
+ | ^^^^^^^^^^ help: change it to: `clippy::test_group`
+
+warning: unknown lint: `this_lint_does_not_exist`
+ --> $DIR/lint_tool_test.rs:33:8
+ |
+LL | #[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: #[warn(unknown_lints)] on by default
+
+warning: lint name `clippy_group` is deprecated and may not have an effect in the future
+ --> $DIR/lint_tool_test.rs:17:9
+ |
+LL | #![deny(clippy_group)]
+ | ^^^^^^^^^^^^ help: change it to: `clippy::group`
+
+error: item is named 'lintme'
+ --> $DIR/lint_tool_test.rs:20:1
+ |
+LL | fn lintme() { } //~ ERROR item is named 'lintme'
| ^^^^^^^^^^^^^^^
|
- = note: #[warn(clippy::test_lint)] on by default
+note: lint level defined here
+ --> $DIR/lint_tool_test.rs:17:9
+ |
+LL | #![deny(clippy_group)]
+ | ^^^^^^^^^^^^
+ = note: #[deny(clippy::test_lint)] implied by #[deny(clippy::group)]
+
+error: item is named 'lintmetoo'
+ --> $DIR/lint_tool_test.rs:28:5
+ |
+LL | fn lintmetoo() { } //~ ERROR item is named 'lintmetoo'
+ | ^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint_tool_test.rs:17:9
+ |
+LL | #![deny(clippy_group)]
+ | ^^^^^^^^^^^^
+ = note: #[deny(clippy::test_group)] implied by #[deny(clippy::group)]
+
+error: aborting due to 2 previous errors