Skip to content

Commit 12b2567

Browse files
authored
chore: use poll_fn from std (#6810)
1 parent 35f244a commit 12b2567

Some content is hidden

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

52 files changed

+67
-187
lines changed

tests-integration/src/bin/test-mem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use futures::future::poll_fn;
1+
use std::future::poll_fn;
22

33
fn main() {
44
let rt = tokio::runtime::Builder::new_multi_thread()

tests-integration/tests/process_stdio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ async fn vectored_writes() {
206206
let mut input = Bytes::from_static(b"hello\n").chain(Bytes::from_static(b"world!\n"));
207207
let mut writes_completed = 0;
208208

209-
futures::future::poll_fn(|cx| loop {
209+
std::future::poll_fn(|cx| loop {
210210
let mut slices = [IoSlice::new(&[]); 2];
211211
let vectored = input.chunks_vectored(&mut slices);
212212
if vectored == 0 {

tokio-stream/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@
7474
#[macro_use]
7575
mod macros;
7676

77-
mod poll_fn;
78-
pub(crate) use poll_fn::poll_fn;
79-
8077
pub mod wrappers;
8178

8279
mod stream_ext;

tokio-stream/src/poll_fn.rs

Lines changed: 0 additions & 35 deletions
This file was deleted.

tokio-stream/src/stream_map.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use crate::{poll_fn, Stream};
1+
use crate::Stream;
22

33
use std::borrow::Borrow;
4+
use std::future::poll_fn;
45
use std::hash::Hash;
56
use std::pin::Pin;
67
use std::task::{ready, Context, Poll};

tokio-util/src/util/poll_buf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::task::{ready, Context, Poll};
1717
/// use tokio_stream as stream;
1818
/// use tokio::io::Result;
1919
/// use tokio_util::io::{StreamReader, poll_read_buf};
20-
/// use futures::future::poll_fn;
20+
/// use std::future::poll_fn;
2121
/// use std::pin::Pin;
2222
/// # #[tokio::main]
2323
/// # async fn main() -> std::io::Result<()> {
@@ -95,9 +95,9 @@ pub fn poll_read_buf<T: AsyncRead + ?Sized, B: BufMut>(
9595
/// use tokio::fs::File;
9696
///
9797
/// use bytes::Buf;
98+
/// use std::future::poll_fn;
9899
/// use std::io::Cursor;
99100
/// use std::pin::Pin;
100-
/// use futures::future::poll_fn;
101101
///
102102
/// #[tokio::main]
103103
/// async fn main() -> io::Result<()> {

tokio-util/tests/io_inspect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use futures::future::poll_fn;
21
use std::{
2+
future::poll_fn,
33
io::IoSlice,
44
pin::Pin,
55
task::{Context, Poll},

tokio-util/tests/mpsc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use futures::future::poll_fn;
21
use futures::sink::SinkExt;
2+
use std::future::poll_fn;
33
use tokio::sync::mpsc::channel;
44
use tokio_test::task::spawn;
55
use tokio_test::{

tokio-util/tests/poll_semaphore.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ type SemRet = Option<OwnedSemaphorePermit>;
99
fn semaphore_poll(
1010
sem: &mut PollSemaphore,
1111
) -> tokio_test::task::Spawn<impl Future<Output = SemRet> + '_> {
12-
let fut = futures::future::poll_fn(move |cx| sem.poll_acquire(cx));
12+
let fut = std::future::poll_fn(move |cx| sem.poll_acquire(cx));
1313
tokio_test::task::spawn(fut)
1414
}
1515

1616
fn semaphore_poll_many(
1717
sem: &mut PollSemaphore,
1818
permits: u32,
1919
) -> tokio_test::task::Spawn<impl Future<Output = SemRet> + '_> {
20-
let fut = futures::future::poll_fn(move |cx| sem.poll_acquire_many(cx, permits));
20+
let fut = std::future::poll_fn(move |cx| sem.poll_acquire_many(cx, permits));
2121
tokio_test::task::spawn(fut)
2222
}
2323

tokio/src/fs/file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ cfg_windows! {
936936

937937
impl Inner {
938938
async fn complete_inflight(&mut self) {
939-
use crate::future::poll_fn;
939+
use std::future::poll_fn;
940940

941941
poll_fn(|cx| self.poll_complete_inflight(cx)).await;
942942
}

0 commit comments

Comments
 (0)