]> git.lizzy.rs Git - rust.git/commitdiff
Add several lints into `unused` lint group
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Fri, 20 Oct 2017 21:00:57 +0000 (00:00 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sun, 29 Oct 2017 19:14:23 +0000 (22:14 +0300)
Remove a couple of obsolete lints

22 files changed:
src/librustc/lib.rs
src/librustc/lint/builtin.rs
src/librustc/lint/mod.rs
src/librustc_lint/builtin.rs
src/librustc_lint/lib.rs
src/librustc_lint/unused.rs
src/librustc_passes/consts.rs
src/test/compile-fail-fulldeps/auxiliary/lint_for_crate.rs
src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs
src/test/compile-fail-fulldeps/auxiliary/lint_plugin_test.rs
src/test/compile-fail/const-eval-overflow.rs
src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs
src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs
src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs
src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs
src/test/ui/const-eval/issue-43197.stderr
src/test/ui/lint/suggestions.rs
src/test/ui/lint/suggestions.stderr
src/test/ui/lint/unused_parens_json_suggestion.rs
src/test/ui/lint/unused_parens_json_suggestion.stderr
src/test/ui/path-lookahead.stderr
src/tools/toolstate.toml

index 77270d10810a799ea81c313cb52a2765ca6af67f..0cec26d339c6931da15173e39509cea485424e9b 100644 (file)
@@ -47,6 +47,7 @@
 #![feature(core_intrinsics)]
 #![feature(i128_type)]
 #![cfg_attr(windows, feature(libc))]
+#![feature(macro_vis_matcher)]
 #![feature(never_type)]
 #![feature(nonzero)]
 #![feature(quote)]
index d28963fc726abf5b6ffd9b89845d27dc12fdbeb3..855cc069d117a4184c258b8d562ddd8da8b94a0c 100644 (file)
     "unknown crate type found in #[crate_type] directive"
 }
 
-declare_lint! {
-    pub FAT_PTR_TRANSMUTES,
-    Allow,
-    "detects transmutes of fat pointers"
-}
-
 declare_lint! {
     pub TRIVIAL_CASTS,
     Allow,
@@ -250,7 +244,6 @@ fn get_lints(&self) -> LintArray {
             UNUSED_FEATURES,
             STABLE_FEATURES,
             UNKNOWN_CRATE_TYPES,
-            FAT_PTR_TRANSMUTES,
             TRIVIAL_CASTS,
             TRIVIAL_NUMERIC_CASTS,
             PRIVATE_IN_PUBLIC,
index 42b5e2dd83de598151b4664026abda4a39f88abb..52dcbfdedef5d23a3ceec8af92095fac62e79a51 100644 (file)
@@ -84,29 +84,16 @@ pub fn name_lower(&self) -> String {
     }
 }
 
-/// Build a `Lint` initializer.
-#[macro_export]
-macro_rules! lint_initializer {
-    ($name:ident, $level:ident, $desc:expr) => (
-        ::rustc::lint::Lint {
-            name: stringify!($name),
-            default_level: ::rustc::lint::$level,
-            desc: $desc,
-        }
-    )
-}
-
 /// Declare a static item of type `&'static Lint`.
 #[macro_export]
 macro_rules! declare_lint {
-    (pub $name:ident, $level:ident, $desc:expr) => (
-        pub static $name: &'static ::rustc::lint::Lint
-            = &lint_initializer!($name, $level, $desc);
-    );
-    ($name:ident, $level:ident, $desc:expr) => (
-        static $name: &'static ::rustc::lint::Lint
-            = &lint_initializer!($name, $level, $desc);
-    );
+    ($vis: vis $NAME: ident, $Level: ident, $desc: expr) => (
+        $vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
+            name: stringify!($NAME),
+            default_level: $crate::lint::$Level,
+            desc: $desc
+        };
+    )
 }
 
 /// Declare a static `LintArray` and return it as an expression.
index bc2a1f08441d1a57582e645ce8e96ac2613e171c..70cac419648d5e663427369a577cac2c27cd2a44 100644 (file)
@@ -621,12 +621,6 @@ fn check_trait_item(&mut self, cx: &EarlyContext, it: &ast::TraitItem) {
     }
 }
 
-declare_lint! {
-    DEPRECATED_ATTR,
-    Warn,
-    "detects use of deprecated attributes"
-}
-
 /// Checks for use of attributes which have been deprecated.
 #[derive(Clone)]
 pub struct DeprecatedAttr {
@@ -645,7 +639,7 @@ pub fn new() -> DeprecatedAttr {
 
 impl LintPass for DeprecatedAttr {
     fn get_lints(&self) -> LintArray {
-        lint_array!(DEPRECATED_ATTR)
+        lint_array!()
     }
 }
 
index 4ba7f7aa951f75c50de6c82a5c687a1dbe03f482..42fcf377d65396a29034d8f557b4ff6f22d4fcdc 100644 (file)
@@ -28,6 +28,7 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 #![feature(i128_type)]
+#![feature(macro_vis_matcher)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(slice_patterns)]
@@ -163,7 +164,12 @@ macro_rules! add_lint_group {
                     UNUSED_UNSAFE,
                     PATH_STATEMENTS,
                     UNUSED_ATTRIBUTES,
-                    UNUSED_MACROS);
+                    UNUSED_MACROS,
+                    UNUSED_ALLOCATION,
+                    UNUSED_DOC_COMMENT,
+                    UNUSED_EXTERN_CRATES,
+                    UNUSED_FEATURES,
+                    UNUSED_PARENS);
 
     // Guidelines for creating a future incompatibility lint:
     //
@@ -239,15 +245,15 @@ macro_rules! add_lint_group {
 
     // Register renamed and removed lints
     store.register_renamed("unknown_features", "unused_features");
-    store.register_removed("unsigned_negation",
-                           "replaced by negate_unsigned feature gate");
+    store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
     store.register_removed("negate_unsigned", "cast a signed value instead");
     store.register_removed("raw_pointer_derive", "using derive with raw pointers is ok");
     // This was renamed to raw_pointer_derive, which was then removed,
     // so it is also considered removed
-    store.register_removed("raw_pointer_deriving",
-                           "using derive with raw pointers is ok");
+    store.register_removed("raw_pointer_deriving", "using derive with raw pointers is ok");
     store.register_removed("drop_with_repr_extern", "drop flags have been removed");
+    store.register_removed("fat_ptr_transmutes", "was accidentally removed back in 2014");
+    store.register_removed("deprecated_attr", "use `deprecated` instead");
     store.register_removed("transmute_from_fn_item_types",
         "always cast functions before transmuting them");
     store.register_removed("hr_lifetime_in_assoc_type",
index a058f84e58806da255b7b2ade7159e7263301795..32f724f7541c7638da2e1a850afa497d9ea833aa 100644 (file)
@@ -225,7 +225,7 @@ fn check_attribute(&mut self, cx: &LateContext, attr: &ast::Attribute) {
 }
 
 declare_lint! {
-    UNUSED_PARENS,
+    pub(super) UNUSED_PARENS,
     Warn,
     "`if`, `match`, `while` and `return` do not need parentheses"
 }
@@ -350,7 +350,7 @@ fn check_item(&mut self, cx: &EarlyContext, item: &ast::Item) {
 }
 
 declare_lint! {
-    UNUSED_ALLOCATION,
+    pub(super) UNUSED_ALLOCATION,
     Warn,
     "detects unnecessary allocations that can be eliminated"
 }
index d3202ba4ab53548bad0e0353c30e1eb62ef8e80d..a6eaff4481c769b8a599a34049f9cc9287532552 100644 (file)
@@ -140,8 +140,7 @@ fn check_const_eval(&self, expr: &'gcx hir::Expr) {
                     self.tcx.lint_node(CONST_ERR,
                                        expr.id,
                                        expr.span,
-                                       &format!("constant evaluation error: {}. This will \
-                                                 become a HARD ERROR in the future",
+                                       &format!("constant evaluation error: {}",
                                                 err.description().into_oneline()));
                 }
             }
index fc53031e7f22662f8e442cd8bcccb9bc86e9d6ea..d3f921e0878aeb43fd82fc040752618e875aad8b 100644 (file)
@@ -12,6 +12,7 @@
 
 #![feature(plugin_registrar, rustc_private)]
 #![feature(box_syntax)]
+#![feature(macro_vis_matcher)]
 
 #[macro_use] extern crate rustc;
 extern crate rustc_plugin;
index 490aa0d469312d30b92af1bf28e57d489634159e..a0c72243d4821fad1fc9d81fb0c4c2e18b1c26a9 100644 (file)
@@ -12,6 +12,7 @@
 
 #![feature(plugin_registrar)]
 #![feature(box_syntax, rustc_private)]
+#![feature(macro_vis_matcher)]
 
 // Load rustc as a plugin to get macros
 #[macro_use]
index 8647797270f9a841f5092b974faf0ec745509cbb..cbbfbd80603606ac9070bb06c102076ab98024ef 100644 (file)
@@ -12,6 +12,7 @@
 
 #![feature(plugin_registrar)]
 #![feature(box_syntax, rustc_private)]
+#![feature(macro_vis_matcher)]
 
 extern crate syntax;
 
index 3c688d58fd195d515153d3330228abd07399c8da..058a8d0a1bd4f5532dde59920b1783be1c71c2b8 100644 (file)
@@ -82,7 +82,7 @@
      );
 
 const VALS_U8: (u8, u8, u8, u8) =
-    ( //~ WARN constant evaluation error: attempt to subtract with overflow.
+    ( //~ WARN constant evaluation error: attempt to subtract with overflow
      -(u8::MIN as i8) as u8,
      u8::MIN - 1,
      //~^ ERROR constant evaluation error
@@ -96,7 +96,7 @@
      );
 
 const VALS_U16: (u16, u16, u16, u16) =
-    ( //~ WARN constant evaluation error: attempt to subtract with overflow.
+    ( //~ WARN constant evaluation error: attempt to subtract with overflow
      -(u16::MIN as i16) as u16,
      u16::MIN - 1,
      //~^ ERROR constant evaluation error
      );
 
 const VALS_U32: (u32, u32, u32, u32) =
-    ( //~ WARN constant evaluation error: attempt to subtract with overflow.
+    ( //~ WARN constant evaluation error: attempt to subtract with overflow
      -(u32::MIN as i32) as u32,
      u32::MIN - 1,
      //~^ ERROR constant evaluation error
      );
 
 const VALS_U64: (u64, u64, u64, u64) =
-    ( //~ WARN constant evaluation error: attempt to subtract with overflow.
+    ( //~ WARN constant evaluation error: attempt to subtract with overflow
      -(u64::MIN as i64) as u64,
      u64::MIN - 1,
      //~^ ERROR constant evaluation error
index fc53031e7f22662f8e442cd8bcccb9bc86e9d6ea..d3f921e0878aeb43fd82fc040752618e875aad8b 100644 (file)
@@ -12,6 +12,7 @@
 
 #![feature(plugin_registrar, rustc_private)]
 #![feature(box_syntax)]
+#![feature(macro_vis_matcher)]
 
 #[macro_use] extern crate rustc;
 extern crate rustc_plugin;
index cf1a631937ba451ea76ba642ae9ebe6511bddbe8..29b6cc012b393ad759a640338c3245e845e301cd 100644 (file)
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 #![feature(box_syntax, plugin, plugin_registrar, rustc_private)]
+#![feature(macro_vis_matcher)]
 #![crate_type = "dylib"]
 
 #[macro_use]
index 490aa0d469312d30b92af1bf28e57d489634159e..a0c72243d4821fad1fc9d81fb0c4c2e18b1c26a9 100644 (file)
@@ -12,6 +12,7 @@
 
 #![feature(plugin_registrar)]
 #![feature(box_syntax, rustc_private)]
+#![feature(macro_vis_matcher)]
 
 // Load rustc as a plugin to get macros
 #[macro_use]
index 8647797270f9a841f5092b974faf0ec745509cbb..cbbfbd80603606ac9070bb06c102076ab98024ef 100644 (file)
@@ -12,6 +12,7 @@
 
 #![feature(plugin_registrar)]
 #![feature(box_syntax, rustc_private)]
+#![feature(macro_vis_matcher)]
 
 extern crate syntax;
 
index 5ff80060eac7af476547f5ad47a14d344042321e..58dedcfd9b10317e82ab16bee93589a2b27a4d07 100644 (file)
@@ -1,4 +1,4 @@
-warning: constant evaluation error: attempt to subtract with overflow. This will become a HARD ERROR in the future
+warning: constant evaluation error: attempt to subtract with overflow
   --> $DIR/issue-43197.rs:18:20
    |
 18 |     const X: u32 = 0-1;
@@ -6,7 +6,7 @@ warning: constant evaluation error: attempt to subtract with overflow. This will
    |
    = note: #[warn(const_err)] on by default
 
-warning: constant evaluation error: attempt to subtract with overflow. This will become a HARD ERROR in the future
+warning: constant evaluation error: attempt to subtract with overflow
   --> $DIR/issue-43197.rs:19:20
    |
 19 |     const Y: u32 = foo(0-1);
index e078056ab5e0abf15b3e4d259a5d9b6509bf6e63..bf2b5769bf83047b01133ba5183e4c1e6957393e 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![warn(unused_mut)] // UI tests pass `-A unused`—see Issue #43896
+#![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896
 #![feature(no_debug)]
 
 #[no_mangle] static SHENZHOU: usize = 1; // should suggest `pub`
index 7a498b56413a9a65929120ad5e1bf72bdc5547c2..a00146668362a2c3d3a7ab4d3f57386aa472a44b 100644 (file)
@@ -4,7 +4,11 @@ warning: unnecessary parentheses around assigned value
 30 |         let mut a = (1); // should suggest no `mut`, no parens
    |                     ^^^ help: remove these parentheses
    |
-   = note: #[warn(unused_parens)] on by default
+note: lint level defined here
+  --> $DIR/suggestions.rs:11:21
+   |
+11 | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896
+   |                     ^^^^^^^^^^^^^
 
 warning: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand. See https://github.com/rust-lang/rust/issues/29721
   --> $DIR/suggestions.rs:27:1
@@ -25,7 +29,7 @@ warning: variable does not need to be mutable
 note: lint level defined here
   --> $DIR/suggestions.rs:11:9
    |
-11 | #![warn(unused_mut)] // UI tests pass `-A unused`—see Issue #43896
+11 | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896
    |         ^^^^^^^^^^
 
 warning: static is marked #[no_mangle], but not exported
index 9decb0cff365f97908744cb3ff6d0c97d689fe87..15251795d5e082a5078b1dfee673aa62e85d1ee2 100644 (file)
@@ -16,6 +16,8 @@
 // stripping away any starting or ending parenthesis characters—hence this
 // test of the JSON error format.
 
+#![warn(unused_parens)]
+
 fn main() {
     // We want to suggest the properly-balanced expression `1 / (2 + 3)`, not
     // the malformed `1 / (2 + 3`
index 701334d889045d6951500e08f12117c7feeb3908..ae5b53da1750387f461b47cb47c33438d53eff58 100644 (file)
@@ -1 +1 @@
-{"message":"unnecessary parentheses around assigned value","code":null,"level":"warning","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":976,"byte_end":989,"line_start":22,"line_end":22,"column_start":14,"column_end":27,"is_primary":true,"text":[{"text":"    let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":27}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"#[warn(unused_parens)] on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":976,"byte_end":989,"line_start":22,"line_end":22,"column_start":14,"column_end":27,"is_primary":true,"text":[{"text":"    let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":27}],"label":null,"suggested_replacement":"1 / (2 + 3)","expansion":null}],"children":[],"rendered":null}],"rendered":null}
+{"message":"unnecessary parentheses around assigned value","code":null,"level":"warning","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":1001,"byte_end":1014,"line_start":24,"line_end":24,"column_start":14,"column_end":27,"is_primary":true,"text":[{"text":"    let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":27}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"lint level defined here","code":null,"level":"note","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":847,"byte_end":860,"line_start":19,"line_end":19,"column_start":9,"column_end":22,"is_primary":true,"text":[{"text":"#![warn(unused_parens)]","highlight_start":9,"highlight_end":22}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":1001,"byte_end":1014,"line_start":24,"line_end":24,"column_start":14,"column_end":27,"is_primary":true,"text":[{"text":"    let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":27}],"label":null,"suggested_replacement":"1 / (2 + 3)","expansion":null}],"children":[],"rendered":null}],"rendered":null}
index 19e22b3f6f94fc8c10aa82f013f0b1ced61ca61e..059312b2851c6ccbefc02addf9dbc4eb48cf0d3a 100644 (file)
@@ -4,7 +4,12 @@ warning: unnecessary parentheses around `return` value
 18 |   return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
    |
-   = note: #[warn(unused_parens)] on by default
+note: lint level defined here
+  --> $DIR/path-lookahead.rs:13:9
+   |
+13 | #![warn(unused)]
+   |         ^^^^^^
+   = note: #[warn(unused_parens)] implied by #[warn(unused)]
 
 warning: function is never used: `with_parens`
   --> $DIR/path-lookahead.rs:17:1
index da4d26d78dabc0cb9e1d4926559b9d6c2f3f5bae..9dd420c14586d5add18cde7756c6af237e51d04a 100644 (file)
@@ -26,7 +26,7 @@
 miri = "Broken"
 
 # ping @Manishearth @llogiq @mcarton @oli-obk
-clippy = "Compiling"
+clippy = "Broken"
 
 # ping @nrc
 rls = "Broken"