diff --git a/tests-integration/tests/process_stdio.rs b/tests-integration/tests/process_stdio.rs index 526fd9ca607..634099a9d39 100644 --- a/tests-integration/tests/process_stdio.rs +++ b/tests-integration/tests/process_stdio.rs @@ -10,6 +10,7 @@ use futures::future::{self, FutureExt}; use std::env; use std::io; use std::process::{ExitStatus, Stdio}; +use std::task::ready; fn cat() -> Command { let mut cmd = Command::new(env!("CARGO_BIN_EXE_test-cat")); @@ -211,7 +212,7 @@ async fn vectored_writes() { if vectored == 0 { return std::task::Poll::Ready(std::io::Result::Ok(())); } - let n = futures::ready!(Pin::new(&mut stdin).poll_write_vectored(cx, &slices))?; + let n = ready!(Pin::new(&mut stdin).poll_write_vectored(cx, &slices))?; writes_completed += 1; input.advance(n); }) diff --git a/tokio-stream/src/macros.rs b/tokio-stream/src/macros.rs index 1e3b61bac72..5aa797b4f41 100644 --- a/tokio-stream/src/macros.rs +++ b/tokio-stream/src/macros.rs @@ -57,12 +57,3 @@ macro_rules! cfg_signal { )* } } - -macro_rules! ready { - ($e:expr $(,)?) => { - match $e { - std::task::Poll::Ready(t) => t, - std::task::Poll::Pending => return std::task::Poll::Pending, - } - }; -} diff --git a/tokio-stream/src/stream_ext/all.rs b/tokio-stream/src/stream_ext/all.rs index b4dbc1e97c3..6ce00a434c1 100644 --- a/tokio-stream/src/stream_ext/all.rs +++ b/tokio-stream/src/stream_ext/all.rs @@ -3,7 +3,7 @@ use crate::Stream; use core::future::Future; use core::marker::PhantomPinned; use core::pin::Pin; -use core::task::{Context, Poll}; +use core::task::{ready, Context, Poll}; use pin_project_lite::pin_project; pin_project! { @@ -42,7 +42,7 @@ where // Take a maximum of 32 items from the stream before yielding. for _ in 0..32 { - match futures_core::ready!(stream.as_mut().poll_next(cx)) { + match ready!(stream.as_mut().poll_next(cx)) { Some(v) => { if !(me.f)(v) { return Poll::Ready(false); diff --git a/tokio-stream/src/stream_ext/any.rs b/tokio-stream/src/stream_ext/any.rs index 31394f249b8..52deec77415 100644 --- a/tokio-stream/src/stream_ext/any.rs +++ b/tokio-stream/src/stream_ext/any.rs @@ -3,7 +3,7 @@ use crate::Stream; use core::future::Future; use core::marker::PhantomPinned; use core::pin::Pin; -use core::task::{Context, Poll}; +use core::task::{ready, Context, Poll}; use pin_project_lite::pin_project; pin_project! { @@ -42,7 +42,7 @@ where // Take a maximum of 32 items from the stream before yielding. for _ in 0..32 { - match futures_core::ready!(stream.as_mut().poll_next(cx)) { + match ready!(stream.as_mut().poll_next(cx)) { Some(v) => { if (me.f)(v) { return Poll::Ready(true); diff --git a/tokio-stream/src/stream_ext/chain.rs b/tokio-stream/src/stream_ext/chain.rs index bd64f33ce4e..f3d360d5397 100644 --- a/tokio-stream/src/stream_ext/chain.rs +++ b/tokio-stream/src/stream_ext/chain.rs @@ -2,7 +2,7 @@ use crate::stream_ext::Fuse; use crate::Stream; use core::pin::Pin; -use core::task::{Context, Poll}; +use core::task::{ready, Context, Poll}; use pin_project_lite::pin_project; pin_project! { diff --git a/tokio-stream/src/stream_ext/chunks_timeout.rs b/tokio-stream/src/stream_ext/chunks_timeout.rs index 48acd9328bc..89b8d49a64d 100644 --- a/tokio-stream/src/stream_ext/chunks_timeout.rs +++ b/tokio-stream/src/stream_ext/chunks_timeout.rs @@ -4,7 +4,7 @@ use tokio::time::{sleep, Sleep}; use core::future::Future; use core::pin::Pin; -use core::task::{Context, Poll}; +use core::task::{ready, Context, Poll}; use pin_project_lite::pin_project; use std::time::Duration; diff --git a/tokio-stream/src/stream_ext/collect.rs b/tokio-stream/src/stream_ext/collect.rs index 60b94d3fd0e..eb9e2197f14 100644 --- a/tokio-stream/src/stream_ext/collect.rs +++ b/tokio-stream/src/stream_ext/collect.rs @@ -4,7 +4,7 @@ use core::future::Future; use core::marker::PhantomPinned; use core::mem; use core::pin::Pin; -use core::task::{Context, Poll}; +use core::task::{ready, Context, Poll}; use pin_project_lite::pin_project; // Do not export this struct until `FromStream` can be unsealed. diff --git a/tokio-stream/src/stream_ext/filter.rs b/tokio-stream/src/stream_ext/filter.rs index f3dd8716b48..1d5defb195b 100644 --- a/tokio-stream/src/stream_ext/filter.rs +++ b/tokio-stream/src/stream_ext/filter.rs @@ -2,7 +2,7 @@ use crate::Stream; use core::fmt; use core::pin::Pin; -use core::task::{Context, Poll}; +use core::task::{ready, Context, Poll}; use pin_project_lite::pin_project; pin_project! { diff --git a/tokio-stream/src/stream_ext/filter_map.rs b/tokio-stream/src/stream_ext/filter_map.rs index fe604a6f4b5..6658d71f05e 100644 --- a/tokio-stream/src/stream_ext/filter_map.rs +++ b/tokio-stream/src/stream_ext/filter_map.rs @@ -2,7 +2,7 @@ use crate::Stream; use core::fmt; use core::pin::Pin; -use core::task::{Context, Poll}; +use core::task::{ready, Context, Poll}; use pin_project_lite::pin_project; pin_project! { diff --git a/tokio-stream/src/stream_ext/fold.rs b/tokio-stream/src/stream_ext/fold.rs index e2e97d8f375..39bace6ec6b 100644 --- a/tokio-stream/src/stream_ext/fold.rs +++ b/tokio-stream/src/stream_ext/fold.rs @@ -3,7 +3,7 @@ use crate::Stream; use core::future::Future; use core::marker::PhantomPinned; use core::pin::Pin; -use core::task::{Context, Poll}; +use core::task::{ready, Context, Poll}; use pin_project_lite::pin_project; pin_project! { diff --git a/tokio-stream/src/stream_ext/fuse.rs b/tokio-stream/src/stream_ext/fuse.rs index 2500641d95d..9d117cf0895 100644 --- a/tokio-stream/src/stream_ext/fuse.rs +++ b/tokio-stream/src/stream_ext/fuse.rs @@ -2,7 +2,7 @@ use crate::Stream; use pin_project_lite::pin_project; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { /// Stream returned by [`fuse()`][super::StreamExt::fuse]. diff --git a/tokio-stream/src/stream_ext/skip.rs b/tokio-stream/src/stream_ext/skip.rs index 80a0a0aff0d..dd310b8562d 100644 --- a/tokio-stream/src/stream_ext/skip.rs +++ b/tokio-stream/src/stream_ext/skip.rs @@ -2,7 +2,7 @@ use crate::Stream; use core::fmt; use core::pin::Pin; -use core::task::{Context, Poll}; +use core::task::{ready, Context, Poll}; use pin_project_lite::pin_project; pin_project! { diff --git a/tokio-stream/src/stream_ext/skip_while.rs b/tokio-stream/src/stream_ext/skip_while.rs index 985a92666e0..d1accd52956 100644 --- a/tokio-stream/src/stream_ext/skip_while.rs +++ b/tokio-stream/src/stream_ext/skip_while.rs @@ -2,7 +2,7 @@ use crate::Stream; use core::fmt; use core::pin::Pin; -use core::task::{Context, Poll}; +use core::task::{ready, Context, Poll}; use pin_project_lite::pin_project; pin_project! { diff --git a/tokio-stream/src/stream_ext/throttle.rs b/tokio-stream/src/stream_ext/throttle.rs index 50001392ee7..4e71debf3ce 100644 --- a/tokio-stream/src/stream_ext/throttle.rs +++ b/tokio-stream/src/stream_ext/throttle.rs @@ -5,7 +5,7 @@ use tokio::time::{Duration, Instant, Sleep}; use std::future::Future; use std::pin::Pin; -use std::task::{self, Poll}; +use std::task::{self, ready, Poll}; use pin_project_lite::pin_project; diff --git a/tokio-stream/src/stream_ext/timeout.rs b/tokio-stream/src/stream_ext/timeout.rs index 17d1349022e..d863af1dbdb 100644 --- a/tokio-stream/src/stream_ext/timeout.rs +++ b/tokio-stream/src/stream_ext/timeout.rs @@ -4,7 +4,7 @@ use tokio::time::{Instant, Sleep}; use core::future::Future; use core::pin::Pin; -use core::task::{Context, Poll}; +use core::task::{ready, Context, Poll}; use pin_project_lite::pin_project; use std::fmt; use std::time::Duration; diff --git a/tokio-stream/src/stream_ext/timeout_repeating.rs b/tokio-stream/src/stream_ext/timeout_repeating.rs index 253d2fd677e..4822261d870 100644 --- a/tokio-stream/src/stream_ext/timeout_repeating.rs +++ b/tokio-stream/src/stream_ext/timeout_repeating.rs @@ -3,7 +3,7 @@ use crate::{Elapsed, Stream}; use tokio::time::Interval; use core::pin::Pin; -use core::task::{Context, Poll}; +use core::task::{ready, Context, Poll}; use pin_project_lite::pin_project; pin_project! { diff --git a/tokio-stream/src/stream_map.rs b/tokio-stream/src/stream_map.rs index cefedcd7e19..2f553f91c90 100644 --- a/tokio-stream/src/stream_map.rs +++ b/tokio-stream/src/stream_map.rs @@ -3,7 +3,7 @@ use crate::{poll_fn, Stream}; use std::borrow::Borrow; use std::hash::Hash; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; /// Combine many streams into one, indexing each source stream with a unique /// key. diff --git a/tokio-stream/src/wrappers/broadcast.rs b/tokio-stream/src/wrappers/broadcast.rs index 711066466a0..21677971d5f 100644 --- a/tokio-stream/src/wrappers/broadcast.rs +++ b/tokio-stream/src/wrappers/broadcast.rs @@ -6,7 +6,7 @@ use futures_core::Stream; use tokio_util::sync::ReusableBoxFuture; use std::fmt; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; /// A wrapper around [`tokio::sync::broadcast::Receiver`] that implements [`Stream`]. /// diff --git a/tokio-stream/src/wrappers/watch.rs b/tokio-stream/src/wrappers/watch.rs index a1ea646035a..a1e4fbfa03a 100644 --- a/tokio-stream/src/wrappers/watch.rs +++ b/tokio-stream/src/wrappers/watch.rs @@ -5,7 +5,7 @@ use futures_core::Stream; use tokio_util::sync::ReusableBoxFuture; use std::fmt; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; use tokio::sync::watch::error::RecvError; /// A wrapper around [`tokio::sync::watch::Receiver`] that implements [`Stream`]. diff --git a/tokio-test/src/io.rs b/tokio-test/src/io.rs index c31d5be5de2..6f597ba2c9e 100644 --- a/tokio-test/src/io.rs +++ b/tokio-test/src/io.rs @@ -23,13 +23,13 @@ use tokio::sync::mpsc; use tokio::time::{self, Duration, Instant, Sleep}; use tokio_stream::wrappers::UnboundedReceiverStream; -use futures_core::{ready, Stream}; +use futures_core::Stream; use std::collections::VecDeque; use std::fmt; use std::future::Future; use std::pin::Pin; use std::sync::Arc; -use std::task::{self, Poll, Waker}; +use std::task::{self, ready, Poll, Waker}; use std::{cmp, io}; /// An I/O object that follows a predefined script. diff --git a/tokio-test/src/stream_mock.rs b/tokio-test/src/stream_mock.rs index a3f3c776502..1a8cf04df1b 100644 --- a/tokio-test/src/stream_mock.rs +++ b/tokio-test/src/stream_mock.rs @@ -36,10 +36,10 @@ use std::collections::VecDeque; use std::pin::Pin; -use std::task::Poll; +use std::task::{ready, Poll}; use std::time::Duration; -use futures_core::{ready, Stream}; +use futures_core::Stream; use std::future::Future; use tokio::time::{sleep_until, Instant, Sleep}; diff --git a/tokio-util/src/codec/framed_impl.rs b/tokio-util/src/codec/framed_impl.rs index e7cb691aed5..5647023ff9a 100644 --- a/tokio-util/src/codec/framed_impl.rs +++ b/tokio-util/src/codec/framed_impl.rs @@ -5,13 +5,12 @@ use futures_core::Stream; use tokio::io::{AsyncRead, AsyncWrite}; use bytes::BytesMut; -use futures_core::ready; use futures_sink::Sink; use pin_project_lite::pin_project; use std::borrow::{Borrow, BorrowMut}; use std::io; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { #[derive(Debug)] diff --git a/tokio-util/src/compat.rs b/tokio-util/src/compat.rs index 423bd956da0..b71e2b1b0f2 100644 --- a/tokio-util/src/compat.rs +++ b/tokio-util/src/compat.rs @@ -1,10 +1,9 @@ //! Compatibility between the `tokio::io` and `futures-io` versions of the //! `AsyncRead` and `AsyncWrite` traits. -use futures_core::ready; use pin_project_lite::pin_project; use std::io; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { /// A compatibility layer that allows conversion between the diff --git a/tokio-util/src/io/inspect.rs b/tokio-util/src/io/inspect.rs index 7604d9a3de1..48fda6170e7 100644 --- a/tokio-util/src/io/inspect.rs +++ b/tokio-util/src/io/inspect.rs @@ -1,8 +1,7 @@ -use futures_core::ready; use pin_project_lite::pin_project; use std::io::{IoSlice, Result}; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; diff --git a/tokio-util/src/io/sink_writer.rs b/tokio-util/src/io/sink_writer.rs index e0789528751..134acbe807d 100644 --- a/tokio-util/src/io/sink_writer.rs +++ b/tokio-util/src/io/sink_writer.rs @@ -1,11 +1,10 @@ -use futures_core::ready; use futures_sink::Sink; use futures_core::stream::Stream; use pin_project_lite::pin_project; use std::io; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; use tokio::io::{AsyncRead, AsyncWrite}; pin_project! { diff --git a/tokio-util/src/sync/poll_semaphore.rs b/tokio-util/src/sync/poll_semaphore.rs index 4960a7c8bd0..ae23d8b73d0 100644 --- a/tokio-util/src/sync/poll_semaphore.rs +++ b/tokio-util/src/sync/poll_semaphore.rs @@ -1,8 +1,8 @@ -use futures_core::{ready, Stream}; +use futures_core::Stream; use std::fmt; use std::pin::Pin; use std::sync::Arc; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; use tokio::sync::{AcquireError, OwnedSemaphorePermit, Semaphore, TryAcquireError}; use super::ReusableBoxFuture; diff --git a/tokio-util/src/time/delay_queue.rs b/tokio-util/src/time/delay_queue.rs index 55dd311a03e..9dadc3f00ae 100644 --- a/tokio-util/src/time/delay_queue.rs +++ b/tokio-util/src/time/delay_queue.rs @@ -6,7 +6,6 @@ use crate::time::wheel::{self, Wheel}; -use futures_core::ready; use tokio::time::{sleep_until, Duration, Instant, Sleep}; use core::ops::{Index, IndexMut}; @@ -19,7 +18,7 @@ use std::fmt::Debug; use std::future::Future; use std::marker::PhantomData; use std::pin::Pin; -use std::task::{self, Poll, Waker}; +use std::task::{self, ready, Poll, Waker}; /// A queue of delayed elements. /// @@ -74,9 +73,8 @@ use std::task::{self, Poll, Waker}; /// ```rust,no_run /// use tokio_util::time::{DelayQueue, delay_queue}; /// -/// use futures::ready; /// use std::collections::HashMap; -/// use std::task::{Context, Poll}; +/// use std::task::{ready, Context, Poll}; /// use std::time::Duration; /// # type CacheKey = String; /// # type Value = String; diff --git a/tokio-util/src/udp/frame.rs b/tokio-util/src/udp/frame.rs index d094c04c6da..38e790ae980 100644 --- a/tokio-util/src/udp/frame.rs +++ b/tokio-util/src/udp/frame.rs @@ -4,10 +4,9 @@ use futures_core::Stream; use tokio::{io::ReadBuf, net::UdpSocket}; use bytes::{BufMut, BytesMut}; -use futures_core::ready; use futures_sink::Sink; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; use std::{ borrow::Borrow, net::{Ipv4Addr, SocketAddr, SocketAddrV4}, diff --git a/tokio-util/src/util/poll_buf.rs b/tokio-util/src/util/poll_buf.rs index 5a72bc4c822..0704e7478d2 100644 --- a/tokio-util/src/util/poll_buf.rs +++ b/tokio-util/src/util/poll_buf.rs @@ -1,11 +1,10 @@ use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; use bytes::{Buf, BufMut}; -use futures_core::ready; use std::io::{self, IoSlice}; use std::mem::MaybeUninit; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; /// Try to read data from an `AsyncRead` into an implementer of the [`BufMut`] trait. /// diff --git a/tokio/src/fs/file.rs b/tokio/src/fs/file.rs index 27d91debbe8..fc0a7294ce7 100644 --- a/tokio/src/fs/file.rs +++ b/tokio/src/fs/file.rs @@ -14,8 +14,7 @@ use std::io::{self, Seek, SeekFrom}; use std::path::Path; use std::pin::Pin; use std::sync::Arc; -use std::task::Context; -use std::task::Poll; +use std::task::{ready, Context, Poll}; #[cfg(test)] use super::mocks::JoinHandle; diff --git a/tokio/src/fs/read_dir.rs b/tokio/src/fs/read_dir.rs index 20d74967cd4..c144f918d01 100644 --- a/tokio/src/fs/read_dir.rs +++ b/tokio/src/fs/read_dir.rs @@ -8,8 +8,7 @@ use std::io; use std::path::{Path, PathBuf}; use std::pin::Pin; use std::sync::Arc; -use std::task::Context; -use std::task::Poll; +use std::task::{ready, Context, Poll}; #[cfg(test)] use super::mocks::spawn_blocking; diff --git a/tokio/src/future/maybe_done.rs b/tokio/src/future/maybe_done.rs index 9ae795f7a7f..ed2136526fc 100644 --- a/tokio/src/future/maybe_done.rs +++ b/tokio/src/future/maybe_done.rs @@ -3,7 +3,7 @@ use pin_project_lite::pin_project; use std::future::{Future, IntoFuture}; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { /// A future that may have completed. diff --git a/tokio/src/io/async_fd.rs b/tokio/src/io/async_fd.rs index 96d0518a6e5..33829367473 100644 --- a/tokio/src/io/async_fd.rs +++ b/tokio/src/io/async_fd.rs @@ -7,7 +7,7 @@ use std::error::Error; use std::fmt; use std::io; use std::os::unix::io::{AsRawFd, RawFd}; -use std::{task::Context, task::Poll}; +use std::task::{ready, Context, Poll}; /// Associates an IO object backed by a Unix file descriptor with the tokio /// reactor, allowing for readiness to be polled. The file descriptor must be of @@ -71,11 +71,10 @@ use std::{task::Context, task::Poll}; /// and using the IO traits [`AsyncRead`] and [`AsyncWrite`]. /// /// ```no_run -/// use futures::ready; /// use std::io::{self, Read, Write}; /// use std::net::TcpStream; /// use std::pin::Pin; -/// use std::task::{Context, Poll}; +/// use std::task::{ready, Context, Poll}; /// use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; /// use tokio::io::unix::AsyncFd; /// diff --git a/tokio/src/io/blocking.rs b/tokio/src/io/blocking.rs index 52aa798c4fe..f189136b52e 100644 --- a/tokio/src/io/blocking.rs +++ b/tokio/src/io/blocking.rs @@ -6,7 +6,7 @@ use std::future::Future; use std::io; use std::io::prelude::*; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; /// `T` should not implement _both_ Read and Write. #[derive(Debug)] diff --git a/tokio/src/io/bsd/poll_aio.rs b/tokio/src/io/bsd/poll_aio.rs index 708ca7484e7..086ba6d93bc 100644 --- a/tokio/src/io/bsd/poll_aio.rs +++ b/tokio/src/io/bsd/poll_aio.rs @@ -11,7 +11,7 @@ use std::io; use std::ops::{Deref, DerefMut}; use std::os::unix::io::AsRawFd; use std::os::unix::prelude::RawFd; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; /// Like [`mio::event::Source`], but for POSIX AIO only. /// diff --git a/tokio/src/io/poll_evented.rs b/tokio/src/io/poll_evented.rs index 73cb8e5809e..0e34fbe3c22 100644 --- a/tokio/src/io/poll_evented.rs +++ b/tokio/src/io/poll_evented.rs @@ -7,6 +7,7 @@ use std::fmt; use std::io; use std::ops::Deref; use std::panic::{RefUnwindSafe, UnwindSafe}; +use std::task::ready; cfg_io_driver! { /// Associates an I/O resource that implements the [`std::io::Read`] and/or diff --git a/tokio/src/io/seek.rs b/tokio/src/io/seek.rs index e64205d9cf6..f28faa85455 100644 --- a/tokio/src/io/seek.rs +++ b/tokio/src/io/seek.rs @@ -5,7 +5,7 @@ use std::future::Future; use std::io::{self, SeekFrom}; use std::marker::PhantomPinned; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { /// Future for the [`seek`](crate::io::AsyncSeekExt::seek) method. diff --git a/tokio/src/io/util/buf_reader.rs b/tokio/src/io/util/buf_reader.rs index d9307202c13..c89fe43dc1a 100644 --- a/tokio/src/io/util/buf_reader.rs +++ b/tokio/src/io/util/buf_reader.rs @@ -4,7 +4,7 @@ use crate::io::{AsyncBufRead, AsyncRead, AsyncSeek, AsyncWrite, ReadBuf}; use pin_project_lite::pin_project; use std::io::{self, IoSlice, SeekFrom}; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; use std::{cmp, fmt, mem}; pin_project! { diff --git a/tokio/src/io/util/buf_writer.rs b/tokio/src/io/util/buf_writer.rs index 2971a8e057a..ea9076ea693 100644 --- a/tokio/src/io/util/buf_writer.rs +++ b/tokio/src/io/util/buf_writer.rs @@ -5,7 +5,7 @@ use pin_project_lite::pin_project; use std::fmt; use std::io::{self, IoSlice, SeekFrom, Write}; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { /// Wraps a writer and buffers its output. diff --git a/tokio/src/io/util/chain.rs b/tokio/src/io/util/chain.rs index f96f42f4a99..9f1912771b8 100644 --- a/tokio/src/io/util/chain.rs +++ b/tokio/src/io/util/chain.rs @@ -4,7 +4,7 @@ use pin_project_lite::pin_project; use std::fmt; use std::io; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { /// Stream for the [`chain`](super::AsyncReadExt::chain) method. diff --git a/tokio/src/io/util/copy.rs b/tokio/src/io/util/copy.rs index 4fcec907578..87592608bed 100644 --- a/tokio/src/io/util/copy.rs +++ b/tokio/src/io/util/copy.rs @@ -3,7 +3,7 @@ use crate::io::{AsyncRead, AsyncWrite, ReadBuf}; use std::future::Future; use std::io; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; #[derive(Debug)] pub(super) struct CopyBuffer { diff --git a/tokio/src/io/util/copy_bidirectional.rs b/tokio/src/io/util/copy_bidirectional.rs index ce90141e5a5..73041953bf8 100644 --- a/tokio/src/io/util/copy_bidirectional.rs +++ b/tokio/src/io/util/copy_bidirectional.rs @@ -5,7 +5,7 @@ use crate::io::{AsyncRead, AsyncWrite}; use std::io; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; enum TransferState { Running(CopyBuffer), diff --git a/tokio/src/io/util/copy_buf.rs b/tokio/src/io/util/copy_buf.rs index c23fc9a2b4c..db622e94aae 100644 --- a/tokio/src/io/util/copy_buf.rs +++ b/tokio/src/io/util/copy_buf.rs @@ -2,7 +2,7 @@ use crate::io::{AsyncBufRead, AsyncWrite}; use std::future::Future; use std::io; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; cfg_io_util! { /// A future that asynchronously copies the entire contents of a reader into a diff --git a/tokio/src/io/util/empty.rs b/tokio/src/io/util/empty.rs index cc86e8b09a1..8821f4f2e35 100644 --- a/tokio/src/io/util/empty.rs +++ b/tokio/src/io/util/empty.rs @@ -4,7 +4,7 @@ use crate::io::{AsyncBufRead, AsyncRead, AsyncSeek, AsyncWrite, ReadBuf}; use std::fmt; use std::io::{self, SeekFrom}; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; cfg_io_util! { /// `Empty` ignores any data written via [`AsyncWrite`], and will always be empty diff --git a/tokio/src/io/util/lines.rs b/tokio/src/io/util/lines.rs index 717f633f950..3de0aeaad98 100644 --- a/tokio/src/io/util/lines.rs +++ b/tokio/src/io/util/lines.rs @@ -5,7 +5,7 @@ use pin_project_lite::pin_project; use std::io; use std::mem; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { /// Reads lines from an [`AsyncBufRead`]. diff --git a/tokio/src/io/util/mem.rs b/tokio/src/io/util/mem.rs index 15916cc0052..bb5ab1e39e2 100644 --- a/tokio/src/io/util/mem.rs +++ b/tokio/src/io/util/mem.rs @@ -7,7 +7,7 @@ use bytes::{Buf, BytesMut}; use std::{ pin::Pin, sync::Arc, - task::{self, Poll, Waker}, + task::{self, ready, Poll, Waker}, }; /// A bidirectional pipe to read and write bytes in memory. diff --git a/tokio/src/io/util/mod.rs b/tokio/src/io/util/mod.rs index b2f8618c7ee..44556e867ca 100644 --- a/tokio/src/io/util/mod.rs +++ b/tokio/src/io/util/mod.rs @@ -88,7 +88,7 @@ cfg_io_util! { cfg_coop! { fn poll_proceed_and_make_progress(cx: &mut std::task::Context<'_>) -> std::task::Poll<()> { - let coop = ready!(crate::runtime::coop::poll_proceed(cx)); + let coop = std::task::ready!(crate::runtime::coop::poll_proceed(cx)); coop.made_progress(); std::task::Poll::Ready(()) } diff --git a/tokio/src/io/util/read.rs b/tokio/src/io/util/read.rs index a1f9c8a0505..26e59c61fa2 100644 --- a/tokio/src/io/util/read.rs +++ b/tokio/src/io/util/read.rs @@ -6,7 +6,7 @@ use std::io; use std::marker::PhantomPinned; use std::marker::Unpin; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; /// Tries to read some bytes directly into the given `buf` in asynchronous /// manner, returning a future type. diff --git a/tokio/src/io/util/read_buf.rs b/tokio/src/io/util/read_buf.rs index 750497c9e0c..c211e042243 100644 --- a/tokio/src/io/util/read_buf.rs +++ b/tokio/src/io/util/read_buf.rs @@ -6,7 +6,7 @@ use std::future::Future; use std::io; use std::marker::PhantomPinned; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pub(crate) fn read_buf<'a, R, B>(reader: &'a mut R, buf: &'a mut B) -> ReadBuf<'a, R, B> where diff --git a/tokio/src/io/util/read_exact.rs b/tokio/src/io/util/read_exact.rs index 217315dcb91..e9e5afbf0b9 100644 --- a/tokio/src/io/util/read_exact.rs +++ b/tokio/src/io/util/read_exact.rs @@ -6,7 +6,7 @@ use std::io; use std::marker::PhantomPinned; use std::marker::Unpin; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; /// A future which can be used to easily read exactly enough bytes to fill /// a buffer. diff --git a/tokio/src/io/util/read_line.rs b/tokio/src/io/util/read_line.rs index eacc7d59602..fdcbc417e21 100644 --- a/tokio/src/io/util/read_line.rs +++ b/tokio/src/io/util/read_line.rs @@ -8,7 +8,7 @@ use std::marker::PhantomPinned; use std::mem; use std::pin::Pin; use std::string::FromUtf8Error; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { /// Future for the [`read_line`](crate::io::AsyncBufReadExt::read_line) method. diff --git a/tokio/src/io/util/read_to_end.rs b/tokio/src/io/util/read_to_end.rs index b56a940eb50..05665026d29 100644 --- a/tokio/src/io/util/read_to_end.rs +++ b/tokio/src/io/util/read_to_end.rs @@ -7,7 +7,7 @@ use std::io; use std::marker::PhantomPinned; use std::mem::{self, MaybeUninit}; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { #[derive(Debug)] diff --git a/tokio/src/io/util/read_to_string.rs b/tokio/src/io/util/read_to_string.rs index b3d82a26bae..18196c52502 100644 --- a/tokio/src/io/util/read_to_string.rs +++ b/tokio/src/io/util/read_to_string.rs @@ -7,7 +7,7 @@ use pin_project_lite::pin_project; use std::future::Future; use std::marker::PhantomPinned; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; use std::{io, mem}; pin_project! { diff --git a/tokio/src/io/util/read_until.rs b/tokio/src/io/util/read_until.rs index fb6fb22d9f1..fbe2609a64c 100644 --- a/tokio/src/io/util/read_until.rs +++ b/tokio/src/io/util/read_until.rs @@ -7,7 +7,7 @@ use std::io; use std::marker::PhantomPinned; use std::mem; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { /// Future for the [`read_until`](crate::io::AsyncBufReadExt::read_until) method. diff --git a/tokio/src/io/util/repeat.rs b/tokio/src/io/util/repeat.rs index 4a3ac78e49e..ecdbc7d062c 100644 --- a/tokio/src/io/util/repeat.rs +++ b/tokio/src/io/util/repeat.rs @@ -3,7 +3,7 @@ use crate::io::{AsyncRead, ReadBuf}; use std::io; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; cfg_io_util! { /// An async reader which yields one byte over and over and over and over and diff --git a/tokio/src/io/util/sink.rs b/tokio/src/io/util/sink.rs index 1c0102d4b2f..01a4b111cc0 100644 --- a/tokio/src/io/util/sink.rs +++ b/tokio/src/io/util/sink.rs @@ -4,7 +4,7 @@ use crate::io::AsyncWrite; use std::fmt; use std::io; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; cfg_io_util! { /// An async writer which will move data into the void. diff --git a/tokio/src/io/util/split.rs b/tokio/src/io/util/split.rs index 7489c242811..c941b04908a 100644 --- a/tokio/src/io/util/split.rs +++ b/tokio/src/io/util/split.rs @@ -5,7 +5,7 @@ use pin_project_lite::pin_project; use std::io; use std::mem; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { /// Splitter for the [`split`](crate::io::AsyncBufReadExt::split) method. diff --git a/tokio/src/io/util/take.rs b/tokio/src/io/util/take.rs index 0787defbe05..b49e00bfcb0 100644 --- a/tokio/src/io/util/take.rs +++ b/tokio/src/io/util/take.rs @@ -3,7 +3,7 @@ use crate::io::{AsyncBufRead, AsyncRead, ReadBuf}; use pin_project_lite::pin_project; use std::convert::TryFrom; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; use std::{cmp, io}; pin_project! { diff --git a/tokio/src/io/util/write_all.rs b/tokio/src/io/util/write_all.rs index abd3e39d310..8330d89e1fc 100644 --- a/tokio/src/io/util/write_all.rs +++ b/tokio/src/io/util/write_all.rs @@ -6,7 +6,7 @@ use std::io; use std::marker::PhantomPinned; use std::mem; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { #[derive(Debug)] diff --git a/tokio/src/io/util/write_all_buf.rs b/tokio/src/io/util/write_all_buf.rs index dd4709aa810..02054913807 100644 --- a/tokio/src/io/util/write_all_buf.rs +++ b/tokio/src/io/util/write_all_buf.rs @@ -6,7 +6,7 @@ use std::future::Future; use std::io::{self, IoSlice}; use std::marker::PhantomPinned; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { /// A future to write some of the buffer to an `AsyncWrite`. diff --git a/tokio/src/io/util/write_buf.rs b/tokio/src/io/util/write_buf.rs index 82fd7a759f6..879dabcb594 100644 --- a/tokio/src/io/util/write_buf.rs +++ b/tokio/src/io/util/write_buf.rs @@ -6,7 +6,7 @@ use std::future::Future; use std::io; use std::marker::PhantomPinned; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; pin_project! { /// A future to write some of the buffer to an `AsyncWrite`. diff --git a/tokio/src/macros/mod.rs b/tokio/src/macros/mod.rs index 82f42dbff35..acf3d010d69 100644 --- a/tokio/src/macros/mod.rs +++ b/tokio/src/macros/mod.rs @@ -9,9 +9,6 @@ mod loom; #[macro_use] mod pin; -#[macro_use] -mod ready; - #[macro_use] mod thread_local; diff --git a/tokio/src/macros/ready.rs b/tokio/src/macros/ready.rs deleted file mode 100644 index 1f48623b801..00000000000 --- a/tokio/src/macros/ready.rs +++ /dev/null @@ -1,8 +0,0 @@ -macro_rules! ready { - ($e:expr $(,)?) => { - match $e { - std::task::Poll::Ready(t) => t, - std::task::Poll::Pending => return std::task::Poll::Pending, - } - }; -} diff --git a/tokio/src/net/addr.rs b/tokio/src/net/addr.rs index fb8248fb3ba..a098990bb79 100644 --- a/tokio/src/net/addr.rs +++ b/tokio/src/net/addr.rs @@ -274,7 +274,7 @@ pub(crate) mod sealed { use std::option; use std::pin::Pin; - use std::task::{Context, Poll}; + use std::task::{ready,Context, Poll}; use std::vec; #[doc(hidden)] diff --git a/tokio/src/net/tcp/listener.rs b/tokio/src/net/tcp/listener.rs index 3f6592abe19..618da62b477 100644 --- a/tokio/src/net/tcp/listener.rs +++ b/tokio/src/net/tcp/listener.rs @@ -8,7 +8,7 @@ cfg_not_wasi! { use std::fmt; use std::io; use std::net::{self, SocketAddr}; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; cfg_net! { /// A TCP socket server, listening for connections. diff --git a/tokio/src/net/tcp/stream.rs b/tokio/src/net/tcp/stream.rs index e20473e5cc3..36eb84cc854 100644 --- a/tokio/src/net/tcp/stream.rs +++ b/tokio/src/net/tcp/stream.rs @@ -12,7 +12,7 @@ use std::fmt; use std::io; use std::net::{Shutdown, SocketAddr}; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; cfg_io_util! { use bytes::BufMut; diff --git a/tokio/src/net/udp.rs b/tokio/src/net/udp.rs index 03a66585047..a34f7b9225b 100644 --- a/tokio/src/net/udp.rs +++ b/tokio/src/net/udp.rs @@ -4,7 +4,7 @@ use crate::net::{to_socket_addrs, ToSocketAddrs}; use std::fmt; use std::io; use std::net::{self, Ipv4Addr, Ipv6Addr, SocketAddr}; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; cfg_io_util! { use bytes::BufMut; diff --git a/tokio/src/net/unix/datagram/socket.rs b/tokio/src/net/unix/datagram/socket.rs index d7786ca82d7..0fde57da133 100644 --- a/tokio/src/net/unix/datagram/socket.rs +++ b/tokio/src/net/unix/datagram/socket.rs @@ -7,7 +7,7 @@ use std::net::Shutdown; use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; use std::os::unix::net; use std::path::Path; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; cfg_io_util! { use bytes::BufMut; diff --git a/tokio/src/net/unix/listener.rs b/tokio/src/net/unix/listener.rs index 5b28dc03f8f..ddd9669f6d1 100644 --- a/tokio/src/net/unix/listener.rs +++ b/tokio/src/net/unix/listener.rs @@ -12,7 +12,7 @@ use std::os::unix::ffi::OsStrExt; use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; use std::os::unix::net::{self, SocketAddr as StdSocketAddr}; use std::path::Path; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; cfg_net_unix! { /// A Unix socket which can accept connections from other Unix sockets. diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index cf1952ac189..bd4a7ecee7b 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -250,8 +250,7 @@ use std::io; use std::path::Path; use std::pin::Pin; use std::process::{Command as StdCommand, ExitStatus, Output, Stdio}; -use std::task::Context; -use std::task::Poll; +use std::task::{ready, Context, Poll}; #[cfg(unix)] use std::os::unix::process::CommandExt; diff --git a/tokio/src/process/unix/pidfd_reaper.rs b/tokio/src/process/unix/pidfd_reaper.rs index 3b7d622b34b..3c540b2b4f2 100644 --- a/tokio/src/process/unix/pidfd_reaper.rs +++ b/tokio/src/process/unix/pidfd_reaper.rs @@ -19,7 +19,7 @@ use std::{ pin::Pin, process::ExitStatus, sync::atomic::{AtomicBool, Ordering::Relaxed}, - task::{Context, Poll}, + task::{ready, Context, Poll}, }; #[derive(Debug)] diff --git a/tokio/src/runtime/coop.rs b/tokio/src/runtime/coop.rs index f2afa75c9c4..e4409ee4312 100644 --- a/tokio/src/runtime/coop.rs +++ b/tokio/src/runtime/coop.rs @@ -312,7 +312,7 @@ mod test { } let mut task = task::spawn(poll_fn(|cx| { - let coop = ready!(poll_proceed(cx)); + let coop = std::task::ready!(poll_proceed(cx)); coop.made_progress(); Poll::Ready(()) })); diff --git a/tokio/src/runtime/io/registration.rs b/tokio/src/runtime/io/registration.rs index dc5961086f7..00410a121fd 100644 --- a/tokio/src/runtime/io/registration.rs +++ b/tokio/src/runtime/io/registration.rs @@ -7,7 +7,7 @@ use crate::runtime::scheduler; use mio::event::Source; use std::io; use std::sync::Arc; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; cfg_io_driver! { /// Associates an I/O resource with the reactor instance that drives it. diff --git a/tokio/src/runtime/task/join.rs b/tokio/src/runtime/task/join.rs index 7e47e568730..aad6094b5ab 100644 --- a/tokio/src/runtime/task/join.rs +++ b/tokio/src/runtime/task/join.rs @@ -5,7 +5,7 @@ use std::future::Future; use std::marker::PhantomData; use std::panic::{RefUnwindSafe, UnwindSafe}; use std::pin::Pin; -use std::task::{Context, Poll, Waker}; +use std::task::{ready, Context, Poll, Waker}; cfg_rt! { /// An owned permission to join on a task (await its termination). diff --git a/tokio/src/runtime/tests/loom_multi_thread.rs b/tokio/src/runtime/tests/loom_multi_thread.rs index c5980c226e0..4a06b343a4d 100644 --- a/tokio/src/runtime/tests/loom_multi_thread.rs +++ b/tokio/src/runtime/tests/loom_multi_thread.rs @@ -21,7 +21,7 @@ use pin_project_lite::pin_project; use std::future::Future; use std::pin::Pin; use std::sync::atomic::Ordering::{Relaxed, SeqCst}; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; mod atomic_take { use loom::sync::atomic::AtomicBool; diff --git a/tokio/src/runtime/tests/loom_multi_thread_alt.rs b/tokio/src/runtime/tests/loom_multi_thread_alt.rs index c8d140e09e3..01b82f67fe8 100644 --- a/tokio/src/runtime/tests/loom_multi_thread_alt.rs +++ b/tokio/src/runtime/tests/loom_multi_thread_alt.rs @@ -23,7 +23,7 @@ use pin_project_lite::pin_project; use std::future::Future; use std::pin::Pin; use std::sync::atomic::Ordering::{Relaxed, SeqCst}; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; mod atomic_take { use loom::sync::atomic::AtomicBool; diff --git a/tokio/src/sync/batch_semaphore.rs b/tokio/src/sync/batch_semaphore.rs index 84f88fb390e..aabee0f5c0e 100644 --- a/tokio/src/sync/batch_semaphore.rs +++ b/tokio/src/sync/batch_semaphore.rs @@ -28,7 +28,7 @@ use std::marker::PhantomPinned; use std::pin::Pin; use std::ptr::NonNull; use std::sync::atomic::Ordering::*; -use std::task::{Context, Poll, Waker}; +use std::task::{ready, Context, Poll, Waker}; use std::{cmp, fmt}; /// An asynchronous counting semaphore which permits waiting on multiple permits at once. diff --git a/tokio/src/sync/broadcast.rs b/tokio/src/sync/broadcast.rs index ba0a44fb8b9..2161a4794ef 100644 --- a/tokio/src/sync/broadcast.rs +++ b/tokio/src/sync/broadcast.rs @@ -128,7 +128,7 @@ use std::marker::PhantomPinned; use std::pin::Pin; use std::ptr::NonNull; use std::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst}; -use std::task::{Context, Poll, Waker}; +use std::task::{ready, Context, Poll, Waker}; /// Sending-half of the [`broadcast`] channel. /// diff --git a/tokio/src/sync/mpsc/chan.rs b/tokio/src/sync/mpsc/chan.rs index 1edd2a755ae..f4cedf0d4dd 100644 --- a/tokio/src/sync/mpsc/chan.rs +++ b/tokio/src/sync/mpsc/chan.rs @@ -13,7 +13,7 @@ use std::panic; use std::process; use std::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release}; use std::task::Poll::{Pending, Ready}; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; /// Channel sender. pub(crate) struct Tx { diff --git a/tokio/src/sync/notify.rs b/tokio/src/sync/notify.rs index 5d344f70411..d76ff922152 100644 --- a/tokio/src/sync/notify.rs +++ b/tokio/src/sync/notify.rs @@ -1041,7 +1041,7 @@ impl Notified<'_> { #[cfg(tokio_taskdump)] if let Some(waker) = waker { let mut ctx = Context::from_waker(waker); - ready!(crate::trace::trace_leaf(&mut ctx)); + std::task::ready!(crate::trace::trace_leaf(&mut ctx)); } if waiter.notification.load(Acquire).is_some() { @@ -1135,7 +1135,7 @@ impl Notified<'_> { #[cfg(tokio_taskdump)] if let Some(waker) = waker { let mut ctx = Context::from_waker(waker); - ready!(crate::trace::trace_leaf(&mut ctx)); + std::task::ready!(crate::trace::trace_leaf(&mut ctx)); } return Poll::Ready(()); } diff --git a/tokio/src/sync/oneshot.rs b/tokio/src/sync/oneshot.rs index ab29b3e3edd..151b9c85c83 100644 --- a/tokio/src/sync/oneshot.rs +++ b/tokio/src/sync/oneshot.rs @@ -135,7 +135,7 @@ use std::mem::MaybeUninit; use std::pin::Pin; use std::sync::atomic::Ordering::{self, AcqRel, Acquire}; use std::task::Poll::{Pending, Ready}; -use std::task::{Context, Poll, Waker}; +use std::task::{ready, Context, Poll, Waker}; /// Sends a value to the associated [`Receiver`]. /// diff --git a/tokio/src/task/consume_budget.rs b/tokio/src/task/consume_budget.rs index 1e398d73b2a..988555b28c6 100644 --- a/tokio/src/task/consume_budget.rs +++ b/tokio/src/task/consume_budget.rs @@ -1,4 +1,4 @@ -use std::task::Poll; +use std::task::{ready, Poll}; /// Consumes a unit of budget and returns the execution back to the Tokio /// runtime *if* the task's coop budget was exhausted. diff --git a/tokio/src/task/yield_now.rs b/tokio/src/task/yield_now.rs index 70a5de53dea..27c1479671f 100644 --- a/tokio/src/task/yield_now.rs +++ b/tokio/src/task/yield_now.rs @@ -2,7 +2,7 @@ use crate::runtime::context; use std::future::Future; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; /// Yields execution back to the Tokio runtime. /// diff --git a/tokio/src/time/interval.rs b/tokio/src/time/interval.rs index 2b5246acfa4..a13030d36a4 100644 --- a/tokio/src/time/interval.rs +++ b/tokio/src/time/interval.rs @@ -5,7 +5,7 @@ use crate::util::trace; use std::future::Future; use std::panic::Location; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; /// Creates new [`Interval`] that yields with interval of `period`. The first /// tick completes immediately. The default [`MissedTickBehavior`] is diff --git a/tokio/src/time/sleep.rs b/tokio/src/time/sleep.rs index d5a68f09554..7e393d0d17a 100644 --- a/tokio/src/time/sleep.rs +++ b/tokio/src/time/sleep.rs @@ -6,7 +6,7 @@ use pin_project_lite::pin_project; use std::future::Future; use std::panic::Location; use std::pin::Pin; -use std::task::{self, Poll}; +use std::task::{self, ready, Poll}; /// Waits until `deadline` is reached. /// diff --git a/tokio/tests/io_copy.rs b/tokio/tests/io_copy.rs index 82d92a9688b..3bde8e7fa69 100644 --- a/tokio/tests/io_copy.rs +++ b/tokio/tests/io_copy.rs @@ -2,12 +2,11 @@ #![cfg(feature = "full")] use bytes::BytesMut; -use futures::ready; use tokio::io::{self, AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, ReadBuf}; use tokio_test::assert_ok; use std::pin::Pin; -use std::task::{Context, Poll}; +use std::task::{ready, Context, Poll}; #[tokio::test] async fn copy() {