Skip to content

Commit 11f66f4

Browse files
authored
chore: replace ready! with std::task::ready! (#6804)
1 parent 479a56a commit 11f66f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+92
-123
lines changed

tests-integration/tests/process_stdio.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use futures::future::{self, FutureExt};
1010
use std::env;
1111
use std::io;
1212
use std::process::{ExitStatus, Stdio};
13+
use std::task::ready;
1314

1415
fn cat() -> Command {
1516
let mut cmd = Command::new(env!("CARGO_BIN_EXE_test-cat"));
@@ -211,7 +212,7 @@ async fn vectored_writes() {
211212
if vectored == 0 {
212213
return std::task::Poll::Ready(std::io::Result::Ok(()));
213214
}
214-
let n = futures::ready!(Pin::new(&mut stdin).poll_write_vectored(cx, &slices))?;
215+
let n = ready!(Pin::new(&mut stdin).poll_write_vectored(cx, &slices))?;
215216
writes_completed += 1;
216217
input.advance(n);
217218
})

tokio-stream/src/macros.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,3 @@ macro_rules! cfg_signal {
5757
)*
5858
}
5959
}
60-
61-
macro_rules! ready {
62-
($e:expr $(,)?) => {
63-
match $e {
64-
std::task::Poll::Ready(t) => t,
65-
std::task::Poll::Pending => return std::task::Poll::Pending,
66-
}
67-
};
68-
}

tokio-stream/src/stream_ext/all.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::Stream;
33
use core::future::Future;
44
use core::marker::PhantomPinned;
55
use core::pin::Pin;
6-
use core::task::{Context, Poll};
6+
use core::task::{ready, Context, Poll};
77
use pin_project_lite::pin_project;
88

99
pin_project! {
@@ -42,7 +42,7 @@ where
4242

4343
// Take a maximum of 32 items from the stream before yielding.
4444
for _ in 0..32 {
45-
match futures_core::ready!(stream.as_mut().poll_next(cx)) {
45+
match ready!(stream.as_mut().poll_next(cx)) {
4646
Some(v) => {
4747
if !(me.f)(v) {
4848
return Poll::Ready(false);

tokio-stream/src/stream_ext/any.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::Stream;
33
use core::future::Future;
44
use core::marker::PhantomPinned;
55
use core::pin::Pin;
6-
use core::task::{Context, Poll};
6+
use core::task::{ready, Context, Poll};
77
use pin_project_lite::pin_project;
88

99
pin_project! {
@@ -42,7 +42,7 @@ where
4242

4343
// Take a maximum of 32 items from the stream before yielding.
4444
for _ in 0..32 {
45-
match futures_core::ready!(stream.as_mut().poll_next(cx)) {
45+
match ready!(stream.as_mut().poll_next(cx)) {
4646
Some(v) => {
4747
if (me.f)(v) {
4848
return Poll::Ready(true);

tokio-stream/src/stream_ext/chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::stream_ext::Fuse;
22
use crate::Stream;
33

44
use core::pin::Pin;
5-
use core::task::{Context, Poll};
5+
use core::task::{ready, Context, Poll};
66
use pin_project_lite::pin_project;
77

88
pin_project! {

tokio-stream/src/stream_ext/chunks_timeout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use tokio::time::{sleep, Sleep};
44

55
use core::future::Future;
66
use core::pin::Pin;
7-
use core::task::{Context, Poll};
7+
use core::task::{ready, Context, Poll};
88
use pin_project_lite::pin_project;
99
use std::time::Duration;
1010

tokio-stream/src/stream_ext/collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use core::future::Future;
44
use core::marker::PhantomPinned;
55
use core::mem;
66
use core::pin::Pin;
7-
use core::task::{Context, Poll};
7+
use core::task::{ready, Context, Poll};
88
use pin_project_lite::pin_project;
99

1010
// Do not export this struct until `FromStream` can be unsealed.

tokio-stream/src/stream_ext/filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::Stream;
22

33
use core::fmt;
44
use core::pin::Pin;
5-
use core::task::{Context, Poll};
5+
use core::task::{ready, Context, Poll};
66
use pin_project_lite::pin_project;
77

88
pin_project! {

tokio-stream/src/stream_ext/filter_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::Stream;
22

33
use core::fmt;
44
use core::pin::Pin;
5-
use core::task::{Context, Poll};
5+
use core::task::{ready, Context, Poll};
66
use pin_project_lite::pin_project;
77

88
pin_project! {

tokio-stream/src/stream_ext/fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::Stream;
33
use core::future::Future;
44
use core::marker::PhantomPinned;
55
use core::pin::Pin;
6-
use core::task::{Context, Poll};
6+
use core::task::{ready, Context, Poll};
77
use pin_project_lite::pin_project;
88

99
pin_project! {

0 commit comments

Comments
 (0)