about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hansch <dev@phansch.net>2019-08-09 07:50:25 +0200
committerPhilipp Hansch <dev@phansch.net>2019-08-12 19:20:36 +0200
commit5114050839ba288cbd1af44ac0261c50c8239493 (patch)
tree145f9b2900d7f3ac4e57daf2a258b3f8e8e934bb
parentc154754b74577906c5d55d57f7daeff02d6a33e7 (diff)
downloadrust-5114050839ba288cbd1af44ac0261c50c8239493.tar.gz
rust-5114050839ba288cbd1af44ac0261c50c8239493.zip
Update lint deprecation for tool lints
Our lint deprecation previously didn't work for tool lints, because
`register_removed` was registering lints to be removed _without_ the
`clippy` prefix.
-rw-r--r--clippy_dev/src/lib.rs6
-rw-r--r--clippy_lints/src/lib.rs22
-rw-r--r--tests/ui/deprecated.rs11
-rw-r--r--tests/ui/deprecated.stderr36
4 files changed, 38 insertions, 37 deletions
diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs
index 392388ffd8a..db407565b19 100644
--- a/clippy_dev/src/lib.rs
+++ b/clippy_dev/src/lib.rs
@@ -126,7 +126,7 @@ pub fn gen_deprecated(lints: &[Lint]) -> Vec<String> {
             l.clone().deprecation.and_then(|depr_text| {
                 Some(vec![
                     "    store.register_removed(".to_string(),
-                    format!("        \"{}\",", l.name),
+                    format!("        \"clippy::{}\",", l.name),
                     format!("        \"{}\",", depr_text),
                     "    );".to_string(),
                 ])
@@ -442,11 +442,11 @@ fn test_gen_deprecated() {
     ];
     let expected: Vec<String> = vec![
         "    store.register_removed(",
-        "        \"should_assert_eq\",",
+        "        \"clippy::should_assert_eq\",",
         "        \"has been superseded by should_assert_eq2\",",
         "    );",
         "    store.register_removed(",
-        "        \"another_deprecated\",",
+        "        \"clippy::another_deprecated\",",
         "        \"will be removed\",",
         "    );",
     ]
diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs
index 1ab943c5923..784a10882aa 100644
--- a/clippy_lints/src/lib.rs
+++ b/clippy_lints/src/lib.rs
@@ -386,47 +386,47 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
     let mut store = reg.sess.lint_store.borrow_mut();
     // begin deprecated lints, do not remove this comment, it’s used in `update_lints`
     store.register_removed(
-        "should_assert_eq",
+        "clippy::should_assert_eq",
         "`assert!()` will be more flexible with RFC 2011",
     );
     store.register_removed(
-        "extend_from_slice",
+        "clippy::extend_from_slice",
         "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice",
     );
     store.register_removed(
-        "range_step_by_zero",
+        "clippy::range_step_by_zero",
         "`iterator.step_by(0)` panics nowadays",
     );
     store.register_removed(
-        "unstable_as_slice",
+        "clippy::unstable_as_slice",
         "`Vec::as_slice` has been stabilized in 1.7",
     );
     store.register_removed(
-        "unstable_as_mut_slice",
+        "clippy::unstable_as_mut_slice",
         "`Vec::as_mut_slice` has been stabilized in 1.7",
     );
     store.register_removed(
-        "str_to_string",
+        "clippy::str_to_string",
         "using `str::to_string` is common even today and specialization will likely happen soon",
     );
     store.register_removed(
-        "string_to_string",
+        "clippy::string_to_string",
         "using `string::to_string` is common even today and specialization will likely happen soon",
     );
     store.register_removed(
-        "misaligned_transmute",
+        "clippy::misaligned_transmute",
         "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr",
     );
     store.register_removed(
-        "assign_ops",
+        "clippy::assign_ops",
         "using compound assignment operators (e.g., `+=`) is harmless",
     );
     store.register_removed(
-        "if_let_redundant_pattern_matching",
+        "clippy::if_let_redundant_pattern_matching",
         "this lint has been changed to redundant_pattern_matching",
     );
     store.register_removed(
-        "unsafe_vector_initialization",
+        "clippy::unsafe_vector_initialization",
         "the replacement suggested by this lint had substantially different behavior",
     );
     // end deprecated lints, do not remove this comment, it’s used in `update_lints`
diff --git a/tests/ui/deprecated.rs b/tests/ui/deprecated.rs
index 2e5c5b7ead1..7ad330cb305 100644
--- a/tests/ui/deprecated.rs
+++ b/tests/ui/deprecated.rs
@@ -1,7 +1,8 @@
-#[warn(str_to_string)]
-#[warn(string_to_string)]
-#[warn(unstable_as_slice)]
-#[warn(unstable_as_mut_slice)]
-#[warn(misaligned_transmute)]
+#[warn(clippy::str_to_string)]
+#[warn(clippy::string_to_string)]
+#[warn(clippy::unstable_as_slice)]
+#[warn(clippy::unstable_as_mut_slice)]
+#[warn(clippy::misaligned_transmute)]
+#[warn(clippy::unused_collect)]
 
 fn main() {}
diff --git a/tests/ui/deprecated.stderr b/tests/ui/deprecated.stderr
index ea809472cb2..df9793a091d 100644
--- a/tests/ui/deprecated.stderr
+++ b/tests/ui/deprecated.stderr
@@ -1,40 +1,40 @@
-error: lint `str_to_string` has been removed: `using `str::to_string` is common even today and specialization will likely happen soon`
+error: lint `clippy::str_to_string` has been removed: `using `str::to_string` is common even today and specialization will likely happen soon`
   --> $DIR/deprecated.rs:1:8
    |
-LL | #[warn(str_to_string)]
-   |        ^^^^^^^^^^^^^
+LL | #[warn(clippy::str_to_string)]
+   |        ^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D renamed-and-removed-lints` implied by `-D warnings`
 
-error: lint `string_to_string` has been removed: `using `string::to_string` is common even today and specialization will likely happen soon`
+error: lint `clippy::string_to_string` has been removed: `using `string::to_string` is common even today and specialization will likely happen soon`
   --> $DIR/deprecated.rs:2:8
    |
-LL | #[warn(string_to_string)]
-   |        ^^^^^^^^^^^^^^^^
+LL | #[warn(clippy::string_to_string)]
+   |        ^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: lint `unstable_as_slice` has been removed: ``Vec::as_slice` has been stabilized in 1.7`
+error: lint `clippy::unstable_as_slice` has been removed: ``Vec::as_slice` has been stabilized in 1.7`
   --> $DIR/deprecated.rs:3:8
    |
-LL | #[warn(unstable_as_slice)]
-   |        ^^^^^^^^^^^^^^^^^
+LL | #[warn(clippy::unstable_as_slice)]
+   |        ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: lint `unstable_as_mut_slice` has been removed: ``Vec::as_mut_slice` has been stabilized in 1.7`
+error: lint `clippy::unstable_as_mut_slice` has been removed: ``Vec::as_mut_slice` has been stabilized in 1.7`
   --> $DIR/deprecated.rs:4:8
    |
-LL | #[warn(unstable_as_mut_slice)]
-   |        ^^^^^^^^^^^^^^^^^^^^^
+LL | #[warn(clippy::unstable_as_mut_slice)]
+   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: lint `misaligned_transmute` has been removed: `this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr`
+error: lint `clippy::misaligned_transmute` has been removed: `this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr`
   --> $DIR/deprecated.rs:5:8
    |
-LL | #[warn(misaligned_transmute)]
-   |        ^^^^^^^^^^^^^^^^^^^^
+LL | #[warn(clippy::misaligned_transmute)]
+   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: lint `str_to_string` has been removed: `using `str::to_string` is common even today and specialization will likely happen soon`
+error: lint `clippy::str_to_string` has been removed: `using `str::to_string` is common even today and specialization will likely happen soon`
   --> $DIR/deprecated.rs:1:8
    |
-LL | #[warn(str_to_string)]
-   |        ^^^^^^^^^^^^^
+LL | #[warn(clippy::str_to_string)]
+   |        ^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 6 previous errors