From 57f8bf59ee1c63ed1280d3793ef7a796dd5033b7 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 6 Jan 2024 15:45:50 +0900 Subject: [PATCH] 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(()); | ~~ ``` --- futures-executor/tests/local_pool.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/futures-executor/tests/local_pool.rs b/futures-executor/tests/local_pool.rs index fc5d90a49..131f37934 100644 --- a/futures-executor/tests/local_pool.rs +++ b/futures-executor/tests/local_pool.rs @@ -3,6 +3,7 @@ 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}; @@ -10,7 +11,7 @@ use std::sync::Arc; use std::thread; use std::time::Duration; -struct Pending(Rc<()>); +struct Pending(PhantomData>); impl Future for Pending { type Output = (); @@ -21,7 +22,7 @@ impl Future for Pending { } fn pending() -> Pending { - Pending(Rc::new(())) + Pending(PhantomData) } #[test]