]> git.lizzy.rs Git - rust.git/commitdiff
Add tests for backward compat
authorflip1995 <9744647+flip1995@users.noreply.github.com>
Mon, 27 Aug 2018 21:22:47 +0000 (23:22 +0200)
committerManish Goregaokar <manishsmail@gmail.com>
Fri, 31 Aug 2018 07:46:30 +0000 (00:46 -0700)
src/test/ui-fulldeps/auxiliary/lint_tool_test.rs
src/test/ui-fulldeps/lint_tool_test.rs
src/test/ui-fulldeps/lint_tool_test.stderr

index d7895bd8781ba02b83fcb3eb45031184e3361373..e184c0919d0ecf333fc94177986d761eeb128bb2 100644 (file)
 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)
     }
 }
 
@@ -39,10 +40,14 @@ fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
         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]);
 }
index ccdcd2df31b4f49afd20bd2202f1088986c2afa3..a132e1d5c6b892bfbb161b1e39f4b7132869aa41 100644 (file)
@@ -8,17 +8,29 @@
 // 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() { }
 }
index 22d0f458e7d7b487690175a9f3547adc8d99bec5..2b3c45439ca71e6a3456a7162fdbe6c22923d49a 100644 (file)
@@ -1,8 +1,56 @@
-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