]> git.lizzy.rs Git - rust.git/commitdiff
Add hint for cfg_attr and fix test
authorflip1995 <9744647+flip1995@users.noreply.github.com>
Wed, 29 Aug 2018 22:12:47 +0000 (00:12 +0200)
committerManish Goregaokar <manishsmail@gmail.com>
Fri, 31 Aug 2018 07:47:09 +0000 (00:47 -0700)
src/librustc/lint/levels.rs
src/test/ui-fulldeps/lint_tool_test.rs
src/test/ui-fulldeps/lint_tool_test.stderr

index 36c28a6227338a0e0c08bb9ebd7bbb68fda4f0c4..7e8f8f309b4b15a2654d69c0e5ea60fd1cd75272 100644 (file)
@@ -280,25 +280,27 @@ pub fn push(&mut self, attrs: &[ast::Attribute]) -> BuilderPush {
                                 let (lvl, src) =
                                     self.sets
                                         .get_lint_level(lint, self.cur, Some(&specs), &sess);
+                                let msg = format!(
+                                    "lint name `{}` is deprecated \
+                                     and may not have an effect in the future \
+                                     Also `cfg_attr(cargo-clippy)` won't be necessary anymore",
+                                    name
+                                );
                                 let mut err = lint::struct_lint_level(
                                     self.sess,
                                     lint,
                                     lvl,
                                     src,
                                     Some(li.span.into()),
-                                    &format!(
-                                        "lint name `{}` is deprecated \
-                                         and may not have an effect in the future",
-                                        name
-                                    ),
+                                    &msg,
                                 );
                                 err.span_suggestion_with_applicability(
                                     li.span,
                                     "change it to",
                                     new_lint_name.to_string(),
                                     Applicability::MachineApplicable,
-                                );
-                                err.emit();
+                                ).emit();
+
                                 let src = LintSource::Node(Symbol::intern(&new_lint_name), li.span);
                                 for id in ids {
                                     specs.insert(*id, (level, src));
index a132e1d5c6b892bfbb161b1e39f4b7132869aa41..aef15c1abb11ad704a516c53bdfc18ec6c4aa4da 100644 (file)
@@ -16,6 +16,7 @@
 #![allow(dead_code)]
 #![deny(clippy_group)]
 //~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
+//~^^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
 
 fn lintme() { } //~ ERROR item is named 'lintme'
 
index 2b3c45439ca71e6a3456a7162fdbe6c22923d49a..f2ee954264b593fab6aecb19383ef568ba1a2a58 100644 (file)
@@ -1,4 +1,4 @@
-warning: lint name `clippy_group` is deprecated and may not have an effect in the future
+warning: lint name `clippy_group` is deprecated and may not have an effect in the future Also `cfg_attr(cargo-clippy)` won't be necessary anymore
   --> $DIR/lint_tool_test.rs:17:9
    |
 LL | #![deny(clippy_group)]
@@ -6,28 +6,28 @@ LL | #![deny(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
+warning: lint name `test_group` is deprecated and may not have an effect in the future Also `cfg_attr(cargo-clippy)` won't be necessary anymore
+  --> $DIR/lint_tool_test.rs:32: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
+  --> $DIR/lint_tool_test.rs:34: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
+warning: lint name `clippy_group` is deprecated and may not have an effect in the future Also `cfg_attr(cargo-clippy)` won't be necessary anymore
   --> $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
+  --> $DIR/lint_tool_test.rs:21:1
    |
 LL | fn lintme() { } //~ ERROR item is named 'lintme'
    | ^^^^^^^^^^^^^^^
@@ -40,7 +40,7 @@ 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
+  --> $DIR/lint_tool_test.rs:29:5
    |
 LL |     fn lintmetoo() { } //~ ERROR item is named 'lintmetoo'
    |     ^^^^^^^^^^^^^^^^^^