]> git.lizzy.rs Git - rust.git/commitdiff
avoid test-wide allowance of unused/dead code
authorRalf Jung <post@ralfj.de>
Thu, 16 Apr 2020 07:25:12 +0000 (09:25 +0200)
committerRalf Jung <post@ralfj.de>
Thu, 16 Apr 2020 07:25:12 +0000 (09:25 +0200)
14 files changed:
tests/run-pass/bitop-beyond-alignment.rs
tests/run-pass/dst-field-align.rs
tests/run-pass/foreign-fn-linkname.rs
tests/run-pass/issue-15063.rs
tests/run-pass/issue-35815.rs
tests/run-pass/issue-53728.rs
tests/run-pass/libc.rs
tests/run-pass/packed_struct.rs
tests/run-pass/regions-mock-trans.rs
tests/run-pass/rfc1623.rs
tests/run-pass/small_enum_size_bug.rs
tests/run-pass/static_mut.rs
tests/run-pass/tag-align-dyn-u64.rs
tests/run-pass/union.rs

index 02031130b8dcc910b25fa0c0bab7cab1fd58aa1d..e540a2a4b723f8604bbf19fec4b092f70b55376d 100644 (file)
@@ -8,14 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(dead_code)]
-
 use std::mem;
 
 enum Tag<A> {
     Tag2(A)
 }
 
+#[allow(dead_code)]
 struct Rec {
     c8: u8,
     t: Tag<u64>
index 7cd0c851b63872e8da78685a9f1498a5a4e79a40..6c827d7b3beae9a51d92233aeae74af9cd2e6596 100644 (file)
@@ -1,5 +1,4 @@
-#![allow(dead_code)]
-
+#[allow(dead_code)]
 struct Foo<T: ?Sized> {
     a: u16,
     b: T
@@ -17,6 +16,7 @@ struct Baz<T: ?Sized> {
     a: T
 }
 
+#[allow(dead_code)]
 struct HasDrop<T: ?Sized> {
     ptr: Box<usize>,
     data: T
index ebb0e5364b94e2f5347b60f8956668d31ecc5c2f..60303c7d7c7c763d7b057144fb4c5a0b5a88ec5f 100644 (file)
@@ -1,7 +1,5 @@
 //ignore-windows: Uses POSIX APIs
-
 #![feature(rustc_private)]
-#![allow(unused_extern_crates)] // rustc bug https://github.com/rust-lang/rust/issues/56098
 
 extern crate libc;
 
index 8ccf87ee7079efaccb241e7f8e04073b21bd673b..c85590bb8b4bdf79d6bab4913ea0b1dcef38ad53 100644 (file)
@@ -1,5 +1,4 @@
-#![allow(dead_code)]
-
+#[allow(dead_code)]
 enum Two { A, B }
 impl Drop for Two {
     fn drop(&mut self) {
index fb0bd8e202fffa01305d63c3cfcb696d8b21618d..62b3220967eddd927ec48307f85fcca08c6bf5bc 100644 (file)
@@ -1,7 +1,6 @@
-#![allow(dead_code)]
-
 use std::mem;
 
+#[allow(dead_code)]
 struct Foo<T: ?Sized> {
     a: i64,
     b: bool,
index 6d440b66b35a0b9238e2f2906a4850450e2dc290..0c858d3444fb369a691d8410573f264351b27c92 100644 (file)
@@ -1,14 +1,16 @@
-#![allow(dead_code)]
-
 #[repr(u16)]
+#[allow(dead_code)]
 enum DeviceKind {
     Nil = 0,
 }
+
 #[repr(packed)]
+#[allow(dead_code)]
 struct DeviceInfo {
     endianness: u8,
     device_kind: DeviceKind,
 }
+
 fn main() {
     let _x = None::<(DeviceInfo, u8)>;
     let _y = None::<(DeviceInfo, u16)>;
index fc154c05c8fc38c1797d27e82af2d0ca56f1d8a9..14d12de0d186d279938c7e4bb322c2ac0ca85ac2 100644 (file)
@@ -2,14 +2,12 @@
 // compile-flags: -Zmiri-disable-isolation
 
 #![feature(rustc_private)]
-#![allow(unused)] // necessary on macos due to conditional compilation
-
-use std::path::PathBuf;
 
 extern crate libc;
 
-fn tmp() -> PathBuf {
-    std::env::var("MIRI_TEMP").map(PathBuf::from).unwrap_or_else(|_| std::env::temp_dir())
+#[cfg(target_os = "linux")]
+fn tmp() -> std::path::PathBuf {
+    std::env::var("MIRI_TEMP").map(std::path::PathBuf::from).unwrap_or_else(|_| std::env::temp_dir())
 }
 
 #[cfg(target_os = "linux")]
index 303e90742fc11d8186430611e00c272a8406c1c3..52b75d1a520ae19cd97ecb3c8e2f7e947f3eaab2 100644 (file)
@@ -1,4 +1,3 @@
-#![allow(dead_code)]
 #![feature(unsize, coerce_unsized)]
 
 #[repr(packed)]
@@ -8,12 +7,14 @@ struct S {
 }
 
 #[repr(packed)]
+#[allow(dead_code)]
 struct Test1<'a> {
     x: u8,
     other: &'a u32,
 }
 
 #[repr(packed)]
+#[allow(dead_code)]
 struct Test2<'a> {
     x: u8,
     other: &'a Test1<'a>,
@@ -26,6 +27,7 @@ fn test(t: Test2) {
 
 fn test_unsizing() {
     #[repr(packed)]
+    #[allow(dead_code)]
     struct UnalignedPtr<'a, T: ?Sized>
     where T: 'a,
     {
index 020ed4927a88b0f759bd1666e2ee753fc02cda6c..0b2433d84fa882d2549a328f2c31a2364e86f647 100644 (file)
@@ -2,8 +2,6 @@
 
 #![feature(rustc_private)]
 
-#![allow(dead_code)]
-
 extern crate libc;
 use std::mem;
 
@@ -13,11 +11,13 @@ struct Bcx<'a> {
     fcx: &'a Fcx<'a>
 }
 
+#[allow(dead_code)]
 struct Fcx<'a> {
     arena: &'a Arena,
     ccx: &'a Ccx
 }
 
+#[allow(dead_code)]
 struct Ccx {
     x: isize
 }
index 2f893d8150c94f44d4bb0cbfe1afbeb7dc31b95b..76e2c01e74505e62c291514d24f472ae548a35c4 100644 (file)
@@ -1,4 +1,4 @@
-#![allow(dead_code)]
+#![allow(dead_code)] // tons of unused statics here...
 
 // very simple test for a 'static static with default lifetime
 static STATIC_STR: &str = "&'static str";
index 7576a97e36adf5715992b29a18b23754328654ee..bb2f597444e77c58d8749e5252d0cdbb23ae9220 100644 (file)
@@ -1,5 +1,4 @@
-#![allow(dead_code)]
-
+#[allow(dead_code)]
 enum E {
     A = 1,
     B = 2,
index be5830698b2117c7c47420668428b236331ea754..0aa6a2e92b6247f659f8463f686231c0fedd2f52 100644 (file)
@@ -1,8 +1,7 @@
-#![allow(dead_code)]
-
 static mut FOO: i32 = 42;
 static BAR: Foo = Foo(unsafe { &FOO as *const _} );
 
+#[allow(dead_code)]
 struct Foo(*const i32);
 
 unsafe impl Sync for Foo {}
index 81c19022ab080c4f1aa1be0107c24819ab67f910..8a97758fbb5943692963f37dea8adca59a51df3e 100644 (file)
@@ -8,14 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(dead_code)]
-
 use std::mem;
 
 enum Tag<A> {
     Tag2(A)
 }
 
+#[allow(dead_code)]
 struct Rec {
     c8: u8,
     t: Tag<u64>
index 342c94f3d4a34aa87901328153cf2704839e2fbc..c80918ee527c2998bcec829e65cda665e14e7cd5 100644 (file)
@@ -1,5 +1,4 @@
 #![feature(untagged_unions)]
-#![allow(dead_code, unused_variables)]
 
 fn main() {
     a();
@@ -9,6 +8,7 @@ fn main() {
 }
 
 fn a() {
+    #[allow(dead_code)]
     union U {
         f1: u32,
         f2: f32,
@@ -27,6 +27,7 @@ struct S {
         y: u32,
     }
 
+    #[allow(dead_code)]
     union U {
         s: S,
         both: u64,
@@ -82,7 +83,7 @@ union MyUnion {
     unsafe {
         match u {
             MyUnion { f1: 10 } => { }
-            MyUnion { f2 } => { panic!("foo"); }
+            MyUnion { f2: _f2 } => { panic!("foo"); }
         }
     }
 }