Skip to content

Commit 5772818

Browse files
committed
Adjust library tests for unused_tuple_struct_fields -> dead_code
1 parent 9fcf9c1 commit 5772818

File tree

14 files changed

+39
-38
lines changed

14 files changed

+39
-38
lines changed

library/alloc/src/boxed.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
//! Creating a recursive data structure:
2525
//!
2626
//! ```
27+
//! ##[allow(dead_code)]
2728
//! #[derive(Debug)]
2829
//! enum List<T> {
2930
//! Cons(T, Box<List<T>>),

library/alloc/src/boxed/thin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ struct WithHeader<H>(NonNull<u8>, PhantomData<H>);
171171
/// An opaque representation of `WithHeader<H>` to avoid the
172172
/// projection invariance of `<T as Pointee>::Metadata`.
173173
#[repr(transparent)]
174-
#[allow(unused_tuple_struct_fields)] // Field only used through `WithHeader` type above.
174+
#[allow(dead_code)] // Field only used through `WithHeader` type above.
175175
struct WithOpaqueHeader(NonNull<u8>);
176176

177177
impl WithOpaqueHeader {

library/alloc/src/collections/btree/set/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ fn test_extend_ref() {
524524
#[test]
525525
fn test_recovery() {
526526
#[derive(Debug)]
527-
struct Foo(&'static str, i32);
527+
struct Foo(&'static str, #[allow(dead_code)] i32);
528528

529529
impl PartialEq for Foo {
530530
fn eq(&self, other: &Self) -> bool {

library/alloc/src/collections/vec_deque/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ fn test_clone_from() {
10851085
fn test_vec_deque_truncate_drop() {
10861086
static mut DROPS: u32 = 0;
10871087
#[derive(Clone)]
1088-
struct Elem(i32);
1088+
struct Elem(#[allow(dead_code)] i32);
10891089
impl Drop for Elem {
10901090
fn drop(&mut self) {
10911091
unsafe {

library/alloc/tests/autotraits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
fn require_sync<T: Sync>(_: T) {}
22
fn require_send_sync<T: Send + Sync>(_: T) {}
33

4-
struct NotSend(*const ());
4+
struct NotSend(#[allow(dead_code)] *const ());
55
unsafe impl Sync for NotSend {}
66

77
#[test]

library/alloc/tests/vec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ fn test_cmp() {
547547
#[test]
548548
fn test_vec_truncate_drop() {
549549
static mut DROPS: u32 = 0;
550-
struct Elem(i32);
550+
struct Elem(#[allow(dead_code)] i32);
551551
impl Drop for Elem {
552552
fn drop(&mut self) {
553553
unsafe {
@@ -1089,7 +1089,7 @@ fn test_into_iter_advance_by() {
10891089

10901090
#[test]
10911091
fn test_into_iter_drop_allocator() {
1092-
struct ReferenceCountedAllocator<'a>(DropCounter<'a>);
1092+
struct ReferenceCountedAllocator<'a>(#[allow(dead_code)] DropCounter<'a>);
10931093

10941094
unsafe impl Allocator for ReferenceCountedAllocator<'_> {
10951095
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, core::alloc::AllocError> {
@@ -2407,7 +2407,7 @@ fn test_vec_dedup_multiple_ident() {
24072407
#[test]
24082408
fn test_vec_dedup_partialeq() {
24092409
#[derive(Debug)]
2410-
struct Foo(i32, i32);
2410+
struct Foo(i32, #[allow(dead_code)] i32);
24112411

24122412
impl PartialEq for Foo {
24132413
fn eq(&self, other: &Foo) -> bool {

library/core/benches/slice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn binary_search_l3_worst_case(b: &mut Bencher) {
9191
}
9292

9393
#[derive(Clone)]
94-
struct Rgb(u8, u8, u8);
94+
struct Rgb(#[allow(dead_code)] u8, #[allow(dead_code)] u8, #[allow(dead_code)] u8);
9595

9696
impl Rgb {
9797
fn gen(i: usize) -> Self {
@@ -154,7 +154,7 @@ swap_with_slice!(swap_with_slice_5x_usize_3000, 3000, |i| [i; 5]);
154154
#[bench]
155155
fn fill_byte_sized(b: &mut Bencher) {
156156
#[derive(Copy, Clone)]
157-
struct NewType(u8);
157+
struct NewType(#[allow(dead_code)] u8);
158158

159159
let mut ary = [NewType(0); 1024];
160160

library/core/tests/any.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn any_unsized() {
122122
fn distinct_type_names() {
123123
// https://github.com/rust-lang/rust/issues/84666
124124

125-
struct Velocity(f32, f32);
125+
struct Velocity(#[allow(dead_code)] f32, #[allow(dead_code)] f32);
126126

127127
fn type_name_of_val<T>(_: T) -> &'static str {
128128
type_name::<T>()

library/core/tests/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ fn array_default_impl_avoids_leaks_on_panic() {
262262
use core::sync::atomic::{AtomicUsize, Ordering::Relaxed};
263263
static COUNTER: AtomicUsize = AtomicUsize::new(0);
264264
#[derive(Debug)]
265-
struct Bomb(usize);
265+
struct Bomb(#[allow(dead_code)] usize);
266266

267267
impl Default for Bomb {
268268
fn default() -> Bomb {

library/core/tests/atomic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ fn ptr_bitops() {
188188
#[cfg(any(not(target_arch = "arm"), target_os = "linux"))] // Missing intrinsic in compiler-builtins
189189
fn ptr_bitops_tagging() {
190190
#[repr(align(16))]
191-
struct Tagme(u128);
191+
struct Tagme(#[allow(dead_code)] u128);
192192

193193
let tagme = Tagme(1000);
194194
let ptr = &tagme as *const Tagme as *mut Tagme;

0 commit comments

Comments
 (0)