Skip to content

Commit 974f9c3

Browse files
committed
avoid test-wide allowance of unused/dead code
1 parent b0fe99e commit 974f9c3

14 files changed

+24
-29
lines changed

tests/run-pass/bitop-beyond-alignment.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![allow(dead_code)]
12-
1311
use std::mem;
1412

1513
enum Tag<A> {
1614
Tag2(A)
1715
}
1816

17+
#[allow(dead_code)]
1918
struct Rec {
2019
c8: u8,
2120
t: Tag<u64>

tests/run-pass/dst-field-align.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#![allow(dead_code)]
2-
1+
#[allow(dead_code)]
32
struct Foo<T: ?Sized> {
43
a: u16,
54
b: T
@@ -17,6 +16,7 @@ struct Baz<T: ?Sized> {
1716
a: T
1817
}
1918

19+
#[allow(dead_code)]
2020
struct HasDrop<T: ?Sized> {
2121
ptr: Box<usize>,
2222
data: T

tests/run-pass/foreign-fn-linkname.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//ignore-windows: Uses POSIX APIs
2-
32
#![feature(rustc_private)]
4-
#![allow(unused_extern_crates)] // rustc bug https://github.com/rust-lang/rust/issues/56098
53

64
extern crate libc;
75

tests/run-pass/issue-15063.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#![allow(dead_code)]
2-
1+
#[allow(dead_code)]
32
enum Two { A, B }
43
impl Drop for Two {
54
fn drop(&mut self) {

tests/run-pass/issue-35815.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
#![allow(dead_code)]
2-
31
use std::mem;
42

3+
#[allow(dead_code)]
54
struct Foo<T: ?Sized> {
65
a: i64,
76
b: bool,

tests/run-pass/issue-53728.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
#![allow(dead_code)]
2-
31
#[repr(u16)]
2+
#[allow(dead_code)]
43
enum DeviceKind {
54
Nil = 0,
65
}
6+
77
#[repr(packed)]
8+
#[allow(dead_code)]
89
struct DeviceInfo {
910
endianness: u8,
1011
device_kind: DeviceKind,
1112
}
13+
1214
fn main() {
1315
let _x = None::<(DeviceInfo, u8)>;
1416
let _y = None::<(DeviceInfo, u16)>;

tests/run-pass/libc.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
// compile-flags: -Zmiri-disable-isolation
33

44
#![feature(rustc_private)]
5-
#![allow(unused)] // necessary on macos due to conditional compilation
6-
7-
use std::path::PathBuf;
85

96
extern crate libc;
107

11-
fn tmp() -> PathBuf {
12-
std::env::var("MIRI_TEMP").map(PathBuf::from).unwrap_or_else(|_| std::env::temp_dir())
8+
#[cfg(target_os = "linux")]
9+
fn tmp() -> std::path::PathBuf {
10+
std::env::var("MIRI_TEMP").map(std::path::PathBuf::from).unwrap_or_else(|_| std::env::temp_dir())
1311
}
1412

1513
#[cfg(target_os = "linux")]

tests/run-pass/packed_struct.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(dead_code)]
21
#![feature(unsize, coerce_unsized)]
32

43
#[repr(packed)]
@@ -8,12 +7,14 @@ struct S {
87
}
98

109
#[repr(packed)]
10+
#[allow(dead_code)]
1111
struct Test1<'a> {
1212
x: u8,
1313
other: &'a u32,
1414
}
1515

1616
#[repr(packed)]
17+
#[allow(dead_code)]
1718
struct Test2<'a> {
1819
x: u8,
1920
other: &'a Test1<'a>,
@@ -26,6 +27,7 @@ fn test(t: Test2) {
2627

2728
fn test_unsizing() {
2829
#[repr(packed)]
30+
#[allow(dead_code)]
2931
struct UnalignedPtr<'a, T: ?Sized>
3032
where T: 'a,
3133
{

tests/run-pass/regions-mock-trans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
#![feature(rustc_private)]
44

5-
#![allow(dead_code)]
6-
75
extern crate libc;
86
use std::mem;
97

@@ -13,11 +11,13 @@ struct Bcx<'a> {
1311
fcx: &'a Fcx<'a>
1412
}
1513

14+
#[allow(dead_code)]
1615
struct Fcx<'a> {
1716
arena: &'a Arena,
1817
ccx: &'a Ccx
1918
}
2019

20+
#[allow(dead_code)]
2121
struct Ccx {
2222
x: isize
2323
}

tests/run-pass/rfc1623.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(dead_code)]
1+
#![allow(dead_code)] // tons of unused statics here...
22

33
// very simple test for a 'static static with default lifetime
44
static STATIC_STR: &str = "&'static str";

0 commit comments

Comments
 (0)