Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ rustdoc-args = ["--cfg", "docsrs"]
base64 = { version = "0.22", optional = true }
bytes = "1.7.1"
futures-channel = { version = "0.3", optional = true }
futures-core = { version = "0.3" }
futures-util = { version = "0.3.16", default-features = false, optional = true }
http = "1.0"
http-body = "1.0.0"
Expand Down
5 changes: 2 additions & 3 deletions src/client/legacy/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::error::Error as StdError;
use std::fmt;
use std::future::Future;
use std::future::{poll_fn, Future};
use std::pin::Pin;
use std::task::{self, Poll};
use std::time::Duration;
Expand All @@ -25,7 +25,6 @@ use super::connect::HttpConnector;
use super::connect::{Alpn, Connect, Connected, Connection};
use super::pool::{self, Ver};

use crate::common::future::poll_fn;
use crate::common::{lazy as hyper_lazy, timer, Exec, Lazy, SyncWrapper};

type BoxSendFuture = Pin<Box<dyn Future<Output = ()> + Send>>;
Expand Down Expand Up @@ -337,7 +336,7 @@ where
e!(SendRequest, err.into_error())
.with_connect_info(pooled.conn_info.clone()),
))
}
};
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/client/legacy/connect/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ pub(super) async fn resolve<R>(resolver: &mut R, name: Name) -> Result<R::Addrs,
where
R: Resolve,
{
crate::common::future::poll_fn(|cx| resolver.poll_ready(cx)).await?;
std::future::poll_fn(|cx| resolver.poll_ready(cx)).await?;
resolver.resolve(name).await
}

Expand Down
3 changes: 1 addition & 2 deletions src/client/legacy/connect/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ use std::marker::PhantomData;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
use std::pin::Pin;
use std::sync::Arc;
use std::task::{self, Poll};
use std::task::{self, ready, Poll};
use std::time::Duration;

use futures_core::ready;
use futures_util::future::Either;
use http::uri::{Scheme, Uri};
use pin_project_lite::pin_project;
Expand Down
3 changes: 1 addition & 2 deletions src/client/legacy/connect/proxy/tunnel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ use std::error::Error as StdError;
use std::future::Future;
use std::marker::{PhantomData, Unpin};
use std::pin::Pin;
use std::task::{self, Poll};
use std::task::{self, ready, Poll};

use futures_core::ready;
use http::{HeaderMap, HeaderValue, Uri};
use hyper::rt::{Read, Write};
use pin_project_lite::pin_project;
Expand Down
3 changes: 1 addition & 2 deletions src/client/legacy/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ use std::hash::Hash;
use std::ops::{Deref, DerefMut};
use std::pin::Pin;
use std::sync::{Arc, Mutex, Weak};
use std::task::{self, Poll};
use std::task::{self, ready, Poll};

use std::time::{Duration, Instant};

use futures_channel::oneshot;
use futures_core::ready;
use tracing::{debug, trace};

use hyper::rt::Timer as _;
Expand Down
9 changes: 4 additions & 5 deletions src/client/pool/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ mod internal {
use std::future::Future;
use std::pin::Pin;
use std::sync::{Arc, Mutex, Weak};
use std::task::{self, Poll};
use std::task::{self, ready, Poll};

use futures_core::ready;
use futures_util::future;
use tokio::sync::oneshot;
use tower_service::Service;
Expand Down Expand Up @@ -451,7 +450,7 @@ mod tests {
let mut cache = super::builder().build(mock);
handle.allow(1);

crate::common::future::poll_fn(|cx| cache.poll_ready(cx))
std::future::poll_fn(|cx| cache.poll_ready(cx))
.await
.unwrap();

Expand All @@ -473,7 +472,7 @@ mod tests {
// only 1 connection should ever be made
handle.allow(1);

crate::common::future::poll_fn(|cx| cache.poll_ready(cx))
std::future::poll_fn(|cx| cache.poll_ready(cx))
.await
.unwrap();
let f = cache.call(1);
Expand All @@ -485,7 +484,7 @@ mod tests {
.expect("call");
drop(cached);

crate::common::future::poll_fn(|cx| cache.poll_ready(cx))
std::future::poll_fn(|cx| cache.poll_ready(cx))
.await
.unwrap();
let f = cache.call(1);
Expand Down
7 changes: 3 additions & 4 deletions src/client/pool/negotiate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ mod internal {
use std::future::Future;
use std::pin::Pin;
use std::sync::{Arc, Mutex};
use std::task::{self, Poll};
use std::task::{self, ready, Poll};

use futures_core::ready;
use pin_project_lite::pin_project;
use tower_layer::Layer;
use tower_service::Service;
Expand Down Expand Up @@ -580,7 +579,7 @@ mod tests {
.upgrade(layer_fn(|s| s))
.build();

crate::common::future::poll_fn(|cx| negotiate.poll_ready(cx))
std::future::poll_fn(|cx| negotiate.poll_ready(cx))
.await
.unwrap();

Expand All @@ -605,7 +604,7 @@ mod tests {
.upgrade(layer_fn(|s| s))
.build();

crate::common::future::poll_fn(|cx| negotiate.poll_ready(cx))
std::future::poll_fn(|cx| negotiate.poll_ready(cx))
.await
.unwrap();

Expand Down
21 changes: 10 additions & 11 deletions src/client/pool/singleton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,8 @@ mod internal {
use std::future::Future;
use std::pin::Pin;
use std::sync::{Mutex, Weak};
use std::task::{self, Poll};
use std::task::{self, ready, Poll};

use futures_core::ready;
use pin_project_lite::pin_project;
use tokio::sync::oneshot;
use tower_service::Service;
Expand Down Expand Up @@ -351,7 +350,7 @@ mod tests {
let mut singleton = Singleton::new(mock_svc);

handle.allow(1);
crate::common::future::poll_fn(|cx| singleton.poll_ready(cx))
std::future::poll_fn(|cx| singleton.poll_ready(cx))
.await
.unwrap();
// First call: should go into Driving
Expand All @@ -374,7 +373,7 @@ mod tests {
let mut singleton = Singleton::new(mock_svc);

handle.allow(1);
crate::common::future::poll_fn(|cx| singleton.poll_ready(cx))
std::future::poll_fn(|cx| singleton.poll_ready(cx))
.await
.unwrap();
// Drive first call to completion
Expand All @@ -396,7 +395,7 @@ mod tests {

// Allow the singleton to be made
outer_handle.allow(2);
crate::common::future::poll_fn(|cx| singleton.poll_ready(cx))
std::future::poll_fn(|cx| singleton.poll_ready(cx))
.await
.unwrap();

Expand All @@ -417,15 +416,15 @@ mod tests {
));

// Drive poll_ready on cached service
let err = crate::common::future::poll_fn(|cx| cached.poll_ready(cx))
let err = std::future::poll_fn(|cx| cached.poll_ready(cx))
.await
.err()
.expect("expected poll_ready error");
assert_eq!(err.to_string(), "cached poll_ready failed");

// After error, the singleton should be cleared, so a new call drives outer again
outer_handle.allow(1);
crate::common::future::poll_fn(|cx| singleton.poll_ready(cx))
std::future::poll_fn(|cx| singleton.poll_ready(cx))
.await
.unwrap();
let fut2 = singleton.call(());
Expand All @@ -436,7 +435,7 @@ mod tests {

// The new cached service should still work
inner_handle2.allow(1);
crate::common::future::poll_fn(|cx| cached2.poll_ready(cx))
std::future::poll_fn(|cx| cached2.poll_ready(cx))
.await
.expect("expected poll_ready");
let cfut2 = cached2.call(());
Expand All @@ -450,7 +449,7 @@ mod tests {
let (mock_svc, mut handle) = tower_test::mock::pair::<(), &'static str>();
let mut singleton = Singleton::new(mock_svc);

crate::common::future::poll_fn(|cx| singleton.poll_ready(cx))
std::future::poll_fn(|cx| singleton.poll_ready(cx))
.await
.unwrap();
let fut1 = singleton.call(());
Expand All @@ -469,14 +468,14 @@ mod tests {
let (mock_svc, mut handle) = tower_test::mock::pair::<(), &'static str>();
let mut singleton = Singleton::new(mock_svc);

crate::common::future::poll_fn(|cx| singleton.poll_ready(cx))
std::future::poll_fn(|cx| singleton.poll_ready(cx))
.await
.unwrap();
let mut fut1 = singleton.call(());
let fut2 = singleton.call(());

// poll driver just once, and then drop
crate::common::future::poll_fn(move |cx| {
std::future::poll_fn(move |cx| {
let _ = Pin::new(&mut fut1).poll(cx);
Poll::Ready(())
})
Expand Down
30 changes: 0 additions & 30 deletions src/common/future.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@ pub(crate) use exec::Exec;
pub(crate) use lazy::{lazy, Started as Lazy};
#[cfg(feature = "client-legacy")]
pub(crate) use sync::SyncWrapper;

pub(crate) mod future;
5 changes: 2 additions & 3 deletions src/rt/io.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use std::marker::Unpin;
use std::pin::Pin;
use std::task::Poll;
use std::task::{ready, Poll};

use futures_core::ready;
use hyper::rt::{Read, ReadBuf, Write};

use crate::common::future::poll_fn;
use std::future::poll_fn;

pub(crate) async fn read<T>(io: &mut T, buf: &mut [u8]) -> Result<usize, std::io::Error>
where
Expand Down
3 changes: 1 addition & 2 deletions src/server/conn/auto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ use std::future::Future;
use std::marker::PhantomPinned;
use std::mem::MaybeUninit;
use std::pin::Pin;
use std::task::{Context, Poll};
use std::task::{ready, Context, Poll};
use std::{error::Error as StdError, io, time::Duration};

use bytes::Bytes;
use futures_core::ready;
use http::{Request, Response};
use http_body::Body;
use hyper::{
Expand Down
3 changes: 1 addition & 2 deletions src/service/oneshot.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use futures_core::ready;
use pin_project_lite::pin_project;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use std::task::{ready, Context, Poll};
use tower_service::Service;

// Vendored from tower::util to reduce dependencies, the code is small enough.
Expand Down
6 changes: 3 additions & 3 deletions tests/legacy_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async fn drop_client_closes_idle_connections() {
res.unwrap();

// not closed yet, just idle
future::poll_fn(|ctx| {
std::future::poll_fn(|ctx| {
assert!(Pin::new(&mut closes).poll_next(ctx).is_pending());
Poll::Ready(())
})
Expand Down Expand Up @@ -561,7 +561,7 @@ async fn client_keep_alive_when_response_before_request_body_ends() {
});

future::join(res, rx2).await.0.unwrap();
future::poll_fn(|ctx| {
std::future::poll_fn(|ctx| {
assert!(Pin::new(&mut closes).poll_next(ctx).is_pending());
Poll::Ready(())
})
Expand Down Expand Up @@ -1255,7 +1255,7 @@ impl tower_service::Service<hyper::Uri> for MockConnector {
type Error = std::io::Error;
type Future = std::pin::Pin<
Box<
dyn futures_util::Future<Output = std::result::Result<Self::Response, Self::Error>>
dyn std::future::Future<Output = std::result::Result<Self::Response, Self::Error>>
+ Send,
>,
>;
Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::future::Future;
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::task::{Context, Poll};

use futures_channel::mpsc;
use futures_util::task::{Context, Poll};
use futures_util::Future;
use futures_util::TryFutureExt;
use hyper::Uri;
use tokio::io::{self, AsyncRead, AsyncWrite, ReadBuf};
Expand Down
Loading