diff --git a/tests/run-pass/bitop-beyond-alignment.rs b/tests/run-pass/bitop-beyond-alignment.rs index 02031130b8dc..e540a2a4b723 100644 --- a/tests/run-pass/bitop-beyond-alignment.rs +++ b/tests/run-pass/bitop-beyond-alignment.rs @@ -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 { Tag2(A) } +#[allow(dead_code)] struct Rec { c8: u8, t: Tag diff --git a/tests/run-pass/dst-field-align.rs b/tests/run-pass/dst-field-align.rs index 7cd0c851b638..6c827d7b3bea 100644 --- a/tests/run-pass/dst-field-align.rs +++ b/tests/run-pass/dst-field-align.rs @@ -1,5 +1,4 @@ -#![allow(dead_code)] - +#[allow(dead_code)] struct Foo { a: u16, b: T @@ -17,6 +16,7 @@ struct Baz { a: T } +#[allow(dead_code)] struct HasDrop { ptr: Box, data: T diff --git a/tests/run-pass/foreign-fn-linkname.rs b/tests/run-pass/foreign-fn-linkname.rs index ebb0e5364b94..60303c7d7c7c 100644 --- a/tests/run-pass/foreign-fn-linkname.rs +++ b/tests/run-pass/foreign-fn-linkname.rs @@ -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; diff --git a/tests/run-pass/issue-15063.rs b/tests/run-pass/issue-15063.rs index 8ccf87ee7079..c85590bb8b4b 100644 --- a/tests/run-pass/issue-15063.rs +++ b/tests/run-pass/issue-15063.rs @@ -1,5 +1,4 @@ -#![allow(dead_code)] - +#[allow(dead_code)] enum Two { A, B } impl Drop for Two { fn drop(&mut self) { diff --git a/tests/run-pass/issue-35815.rs b/tests/run-pass/issue-35815.rs index fb0bd8e202ff..62b3220967ed 100644 --- a/tests/run-pass/issue-35815.rs +++ b/tests/run-pass/issue-35815.rs @@ -1,7 +1,6 @@ -#![allow(dead_code)] - use std::mem; +#[allow(dead_code)] struct Foo { a: i64, b: bool, diff --git a/tests/run-pass/issue-53728.rs b/tests/run-pass/issue-53728.rs index 6d440b66b35a..0c858d3444fb 100644 --- a/tests/run-pass/issue-53728.rs +++ b/tests/run-pass/issue-53728.rs @@ -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)>; diff --git a/tests/run-pass/libc.rs b/tests/run-pass/libc.rs index fc154c05c8fc..14d12de0d186 100644 --- a/tests/run-pass/libc.rs +++ b/tests/run-pass/libc.rs @@ -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")] diff --git a/tests/run-pass/packed_struct.rs b/tests/run-pass/packed_struct.rs index 303e90742fc1..52b75d1a520a 100644 --- a/tests/run-pass/packed_struct.rs +++ b/tests/run-pass/packed_struct.rs @@ -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, { diff --git a/tests/run-pass/regions-mock-trans.rs b/tests/run-pass/regions-mock-trans.rs index 020ed4927a88..0b2433d84fa8 100644 --- a/tests/run-pass/regions-mock-trans.rs +++ b/tests/run-pass/regions-mock-trans.rs @@ -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 } diff --git a/tests/run-pass/rfc1623.rs b/tests/run-pass/rfc1623.rs index 2f893d8150c9..76e2c01e7450 100644 --- a/tests/run-pass/rfc1623.rs +++ b/tests/run-pass/rfc1623.rs @@ -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"; diff --git a/tests/run-pass/small_enum_size_bug.rs b/tests/run-pass/small_enum_size_bug.rs index 7576a97e36ad..bb2f597444e7 100644 --- a/tests/run-pass/small_enum_size_bug.rs +++ b/tests/run-pass/small_enum_size_bug.rs @@ -1,5 +1,4 @@ -#![allow(dead_code)] - +#[allow(dead_code)] enum E { A = 1, B = 2, diff --git a/tests/run-pass/static_mut.rs b/tests/run-pass/static_mut.rs index be5830698b21..0aa6a2e92b62 100644 --- a/tests/run-pass/static_mut.rs +++ b/tests/run-pass/static_mut.rs @@ -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 {} diff --git a/tests/run-pass/tag-align-dyn-u64.rs b/tests/run-pass/tag-align-dyn-u64.rs index 81c19022ab08..8a97758fbb59 100644 --- a/tests/run-pass/tag-align-dyn-u64.rs +++ b/tests/run-pass/tag-align-dyn-u64.rs @@ -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 { Tag2(A) } +#[allow(dead_code)] struct Rec { c8: u8, t: Tag diff --git a/tests/run-pass/union.rs b/tests/run-pass/union.rs index 342c94f3d4a3..c80918ee527c 100644 --- a/tests/run-pass/union.rs +++ b/tests/run-pass/union.rs @@ -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 @@ fn b() { y: u32, } + #[allow(dead_code)] union U { s: S, both: u64, @@ -82,7 +83,7 @@ fn d() { unsafe { match u { MyUnion { f1: 10 } => { } - MyUnion { f2 } => { panic!("foo"); } + MyUnion { f2: _f2 } => { panic!("foo"); } } } }