Skip to content

Commit 57f8bf5

Browse files
committed
tests: Fix dead_code warning for tuple struct
``` error: field `0` is never read --> futures-executor/tests/local_pool.rs:13:16 | 13 | struct Pending(Rc<()>); | ------- ^^^^^^ | | | field in this struct | = note: `-D dead-code` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(dead_code)]` help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 13 | struct Pending(()); | ~~ ```
1 parent 72e7e39 commit 57f8bf5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

futures-executor/tests/local_pool.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ use futures::executor::LocalPool;
33
use futures::future::{self, lazy, poll_fn, Future};
44
use futures::task::{Context, LocalSpawn, LocalSpawnExt, Poll, Spawn, SpawnExt, Waker};
55
use std::cell::{Cell, RefCell};
6+
use std::marker::PhantomData;
67
use std::pin::Pin;
78
use std::rc::Rc;
89
use std::sync::atomic::{AtomicBool, Ordering};
910
use std::sync::Arc;
1011
use std::thread;
1112
use std::time::Duration;
1213

13-
struct Pending(Rc<()>);
14+
struct Pending(PhantomData<Rc<()>>);
1415

1516
impl Future for Pending {
1617
type Output = ();
@@ -21,7 +22,7 @@ impl Future for Pending {
2122
}
2223

2324
fn pending() -> Pending {
24-
Pending(Rc::new(()))
25+
Pending(PhantomData)
2526
}
2627

2728
#[test]

0 commit comments

Comments
 (0)