Skip to content

Commit

Permalink
tests: Fix dead_code warning for tuple struct
Browse files Browse the repository at this point in the history
```
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(());
   |                ~~
```
  • Loading branch information
taiki-e committed Jan 6, 2024
1 parent 72e7e39 commit 57f8bf5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions futures-executor/tests/local_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ use futures::executor::LocalPool;
use futures::future::{self, lazy, poll_fn, Future};
use futures::task::{Context, LocalSpawn, LocalSpawnExt, Poll, Spawn, SpawnExt, Waker};
use std::cell::{Cell, RefCell};
use std::marker::PhantomData;
use std::pin::Pin;
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::thread;
use std::time::Duration;

struct Pending(Rc<()>);
struct Pending(PhantomData<Rc<()>>);

impl Future for Pending {
type Output = ();
Expand All @@ -21,7 +22,7 @@ impl Future for Pending {
}

fn pending() -> Pending {
Pending(Rc::new(()))
Pending(PhantomData)
}

#[test]
Expand Down

0 comments on commit 57f8bf5

Please sign in to comment.