refactor(lib): update to 2018 edition

This commit is contained in:
Sean McArthur
2019-07-09 14:50:51 -07:00
parent 79ae89e066
commit da9b0319ef
37 changed files with 358 additions and 398 deletions

View File

@@ -18,12 +18,12 @@ use futures::future::{self, Either, Executor};
use h2;
use tokio_io::{AsyncRead, AsyncWrite};
use body::Payload;
use common::Exec;
use upgrade::Upgraded;
use proto;
use crate::body::Payload;
use crate::common::Exec;
use crate::upgrade::Upgraded;
use crate::proto;
use super::dispatch;
use {Body, Request, Response};
use crate::{Body, Request, Response};
type Http1Dispatcher<T, B, R> = proto::dispatch::Dispatcher<
proto::dispatch::Client<B>,
@@ -39,7 +39,7 @@ type ConnEither<T, B> = Either<
/// Returns a `Handshake` future over some IO.
///
/// This is a shortcut for `Builder::new().handshake(io)`.
pub fn handshake<T>(io: T) -> Handshake<T, ::Body>
pub fn handshake<T>(io: T) -> Handshake<T, crate::Body>
where
T: AsyncRead + AsyncWrite + Send + 'static,
{
@@ -98,7 +98,7 @@ pub struct Handshake<T, B> {
pub struct ResponseFuture {
// for now, a Box is used to hide away the internal `B`
// that can be returned if canceled
inner: Box<dyn Future<Item=Response<Body>, Error=::Error> + Send>,
inner: Box<dyn Future<Item=Response<Body>, Error=crate::Error> + Send>,
}
/// Deconstructed parts of a `Connection`.
@@ -145,7 +145,7 @@ impl<B> SendRequest<B>
/// Polls to determine whether this sender can be used yet for a request.
///
/// If the associated connection is closed, this returns an Error.
pub fn poll_ready(&mut self) -> Poll<(), ::Error> {
pub fn poll_ready(&mut self) -> Poll<(), crate::Error> {
self.dispatch.poll_ready()
}
@@ -235,7 +235,7 @@ where
},
Err(_req) => {
debug!("connection was not ready");
let err = ::Error::new_canceled().with("connection was not ready");
let err = crate::Error::new_canceled().with("connection was not ready");
Either::B(future::err(err))
}
};
@@ -245,7 +245,7 @@ where
}
}
pub(crate) fn send_request_retryable(&mut self, req: Request<B>) -> impl Future<Item = Response<Body>, Error = (::Error, Option<Request<B>>)>
pub(crate) fn send_request_retryable(&mut self, req: Request<B>) -> impl Future<Item = Response<Body>, Error = (crate::Error, Option<Request<B>>)>
where
B: Send,
{
@@ -262,7 +262,7 @@ where
},
Err(req) => {
debug!("connection was not ready");
let err = ::Error::new_canceled().with("connection was not ready");
let err = crate::Error::new_canceled().with("connection was not ready");
Either::B(future::err((err, Some(req))))
}
}
@@ -305,7 +305,7 @@ impl<B> Http2SendRequest<B>
where
B: Payload + 'static,
{
pub(super) fn send_request_retryable(&mut self, req: Request<B>) -> impl Future<Item=Response<Body>, Error=(::Error, Option<Request<B>>)>
pub(super) fn send_request_retryable(&mut self, req: Request<B>) -> impl Future<Item=Response<Body>, Error=(crate::Error, Option<Request<B>>)>
where
B: Send,
{
@@ -322,7 +322,7 @@ where
},
Err(req) => {
debug!("connection was not ready");
let err = ::Error::new_canceled().with("connection was not ready");
let err = crate::Error::new_canceled().with("connection was not ready");
Either::B(future::err((err, Some(req))))
}
}
@@ -380,7 +380,7 @@ where
/// Use [`poll_fn`](https://docs.rs/futures/0.1.25/futures/future/fn.poll_fn.html)
/// and [`try_ready!`](https://docs.rs/futures/0.1.25/futures/macro.try_ready.html)
/// to work with this function; or use the `without_shutdown` wrapper.
pub fn poll_without_shutdown(&mut self) -> Poll<(), ::Error> {
pub fn poll_without_shutdown(&mut self) -> Poll<(), crate::Error> {
match self.inner.as_mut().expect("already upgraded") {
&mut Either::A(ref mut h1) => {
h1.poll_without_shutdown()
@@ -393,9 +393,9 @@ where
/// Prevent shutdown of the underlying IO object at the end of service the request,
/// instead run `into_parts`. This is a convenience wrapper over `poll_without_shutdown`.
pub fn without_shutdown(self) -> impl Future<Item=Parts<T>, Error=::Error> {
pub fn without_shutdown(self) -> impl Future<Item=Parts<T>, Error=crate::Error> {
let mut conn = Some(self);
::futures::future::poll_fn(move || -> ::Result<_> {
::futures::future::poll_fn(move || -> crate::Result<_> {
try_ready!(conn.as_mut().unwrap().poll_without_shutdown());
Ok(conn.take().unwrap().into_parts().into())
})
@@ -408,7 +408,7 @@ where
B: Payload + 'static,
{
type Item = ();
type Error = ::Error;
type Error = crate::Error;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
match try_ready!(self.inner.poll()) {
@@ -552,7 +552,7 @@ where
B: Payload + 'static,
{
type Item = (SendRequest<B>, Connection<T, B>);
type Error = ::Error;
type Error = crate::Error;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
let io = self.io.take().expect("polled more than once");
@@ -601,7 +601,7 @@ impl<T, B> fmt::Debug for Handshake<T, B> {
impl Future for ResponseFuture {
type Item = Response<Body>;
type Error = ::Error;
type Error = crate::Error;
#[inline]
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
@@ -620,7 +620,7 @@ impl fmt::Debug for ResponseFuture {
impl<B> Future for WhenReady<B> {
type Item = SendRequest<B>;
type Error = ::Error;
type Error = crate::Error;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
let mut tx = self.tx.take().expect("polled after complete");

View File

@@ -11,7 +11,7 @@ use std::{fmt, mem};
use bytes::{BufMut, Bytes, BytesMut};
use futures::Future;
use http::{uri, Response, Uri};
use ::http::{uri, Response, Uri};
use tokio_io::{AsyncRead, AsyncWrite};
#[cfg(feature = "runtime")] pub mod dns;
@@ -68,9 +68,9 @@ impl Destination {
///
/// Returns an error if the uri contains no authority or
/// no scheme.
pub fn try_from_uri(uri: Uri) -> ::Result<Self> {
uri.authority_part().ok_or(::error::Parse::Uri)?;
uri.scheme_part().ok_or(::error::Parse::Uri)?;
pub fn try_from_uri(uri: Uri) -> crate::Result<Self> {
uri.authority_part().ok_or(crate::error::Parse::Uri)?;
uri.scheme_part().ok_or(crate::error::Parse::Uri)?;
Ok(Destination { uri })
}
@@ -116,8 +116,8 @@ impl Destination {
/// # Error
///
/// Returns an error if the string is not a valid scheme.
pub fn set_scheme(&mut self, scheme: &str) -> ::Result<()> {
let scheme = scheme.parse().map_err(::error::Parse::from)?;
pub fn set_scheme(&mut self, scheme: &str) -> crate::Result<()> {
let scheme = scheme.parse().map_err(crate::error::Parse::from)?;
self.update_uri(move |parts| {
parts.scheme = Some(scheme);
})
@@ -143,19 +143,19 @@ impl Destination {
/// # Error
///
/// Returns an error if the string is not a valid hostname.
pub fn set_host(&mut self, host: &str) -> ::Result<()> {
pub fn set_host(&mut self, host: &str) -> crate::Result<()> {
// Prevent any userinfo setting, it's bad!
if host.contains('@') {
return Err(::error::Parse::Uri.into());
return Err(crate::error::Parse::Uri.into());
}
let auth = if let Some(port) = self.port() {
let bytes = Bytes::from(format!("{}:{}", host, port));
uri::Authority::from_shared(bytes)
.map_err(::error::Parse::from)?
.map_err(crate::error::Parse::from)?
} else {
let auth = host.parse::<uri::Authority>().map_err(::error::Parse::from)?;
let auth = host.parse::<uri::Authority>().map_err(crate::error::Parse::from)?;
if auth.port_part().is_some() { // std::uri::Authority::Uri
return Err(::error::Parse::Uri.into());
return Err(crate::error::Parse::Uri.into());
}
auth
};
@@ -218,7 +218,7 @@ impl Destination {
.expect("valid uri should be valid with port");
}
fn update_uri<F>(&mut self, f: F) -> ::Result<()>
fn update_uri<F>(&mut self, f: F) -> crate::Result<()>
where
F: FnOnce(&mut uri::Parts)
{
@@ -236,7 +236,7 @@ impl Destination {
},
Err(err) => {
self.uri = old_uri;
Err(::error::Parse::from(err).into())
Err(crate::error::Parse::from(err).into())
},
}
}
@@ -254,7 +254,7 @@ impl Destination {
#[cfg(try_from)]
impl TryFrom<Uri> for Destination {
type Error = ::error::Error;
type Error = crate::error::Error;
fn try_from(uri: Uri) -> Result<Self, Self::Error> {
Destination::try_from_uri(uri)
@@ -325,7 +325,7 @@ impl Connected {
// ===== impl Extra =====
impl Extra {
pub(super) fn set(&self, res: &mut Response<::Body>) {
pub(super) fn set(&self, res: &mut Response<crate::Body>) {
self.0.set(res);
}
}
@@ -345,7 +345,7 @@ impl fmt::Debug for Extra {
trait ExtraInner: Send + Sync {
fn clone_box(&self) -> Box<dyn ExtraInner>;
fn set(&self, res: &mut Response<::Body>);
fn set(&self, res: &mut Response<crate::Body>);
}
// This indirection allows the `Connected` to have a type-erased "extra" value,
@@ -362,7 +362,7 @@ where
Box::new(self.clone())
}
fn set(&self, res: &mut Response<::Body>) {
fn set(&self, res: &mut Response<crate::Body>) {
res.extensions_mut().insert(self.0.clone());
}
}
@@ -383,7 +383,7 @@ where
Box::new(self.clone())
}
fn set(&self, res: &mut Response<::Body>) {
fn set(&self, res: &mut Response<crate::Body>) {
self.0.set(res);
res.extensions_mut().insert(self.1.clone());
}
@@ -567,7 +567,7 @@ mod tests {
let c1 = Connected::new()
.extra(Ex1(41));
let mut res1 = ::Response::new(::Body::empty());
let mut res1 = crate::Response::new(crate::Body::empty());
assert_eq!(res1.extensions().get::<Ex1>(), None);
@@ -590,7 +590,7 @@ mod tests {
.extra(Ex2("zoom"))
.extra(Ex3("pew pew"));
let mut res1 = ::Response::new(::Body::empty());
let mut res1 = crate::Response::new(crate::Body::empty());
assert_eq!(res1.extensions().get::<Ex1>(), None);
assert_eq!(res1.extensions().get::<Ex2>(), None);
@@ -612,7 +612,7 @@ mod tests {
.extra(Ex2("hiccup"))
.extra(Ex1(99));
let mut res2 = ::Response::new(::Body::empty());
let mut res2 = crate::Response::new(crate::Body::empty());
c2
.extra

View File

@@ -2,10 +2,10 @@ use futures::{future, Async, Future, Poll, Stream};
use futures::sync::{mpsc, oneshot};
use want;
use common::Never;
use crate::common::Never;
pub type RetryPromise<T, U> = oneshot::Receiver<Result<U, (::Error, Option<T>)>>;
pub type Promise<T> = oneshot::Receiver<Result<T, ::Error>>;
pub type RetryPromise<T, U> = oneshot::Receiver<Result<U, (crate::Error, Option<T>)>>;
pub type Promise<T> = oneshot::Receiver<Result<T, crate::Error>>;
pub fn channel<T, U>() -> (Sender<T, U>, Receiver<T, U>) {
let (tx, rx) = mpsc::unbounded();
@@ -51,9 +51,9 @@ pub struct UnboundedSender<T, U> {
}
impl<T, U> Sender<T, U> {
pub fn poll_ready(&mut self) -> Poll<(), ::Error> {
pub fn poll_ready(&mut self) -> Poll<(), crate::Error> {
self.giver.poll_want()
.map_err(|_| ::Error::new_closed())
.map_err(|_| crate::Error::new_closed())
}
pub fn is_ready(&self) -> bool {
@@ -167,14 +167,14 @@ struct Envelope<T, U>(Option<(T, Callback<T, U>)>);
impl<T, U> Drop for Envelope<T, U> {
fn drop(&mut self) {
if let Some((val, cb)) = self.0.take() {
let _ = cb.send(Err((::Error::new_canceled().with("connection closed"), Some(val))));
let _ = cb.send(Err((crate::Error::new_canceled().with("connection closed"), Some(val))));
}
}
}
pub enum Callback<T, U> {
Retry(oneshot::Sender<Result<U, (::Error, Option<T>)>>),
NoRetry(oneshot::Sender<Result<U, ::Error>>),
Retry(oneshot::Sender<Result<U, (crate::Error, Option<T>)>>),
NoRetry(oneshot::Sender<Result<U, crate::Error>>),
}
impl<T, U> Callback<T, U> {
@@ -192,7 +192,7 @@ impl<T, U> Callback<T, U> {
}
}
pub(crate) fn send(self, val: Result<U, (::Error, Option<T>)>) {
pub(crate) fn send(self, val: Result<U, (crate::Error, Option<T>)>) {
match self {
Callback::Retry(tx) => {
let _ = tx.send(val);
@@ -205,7 +205,7 @@ impl<T, U> Callback<T, U> {
pub(crate) fn send_when(
self,
mut when: impl Future<Item=U, Error=(::Error, Option<T>)>,
mut when: impl Future<Item=U, Error=(crate::Error, Option<T>)>,
) -> impl Future<Item=(), Error=()> {
let mut cb = Some(self);
@@ -266,7 +266,7 @@ mod tests {
.expect_err("promise should error");
match (err.0.kind(), err.1) {
(&::error::Kind::Canceled, Some(_)) => (),
(&crate::error::Kind::Canceled, Some(_)) => (),
e => panic!("expected Error::Cancel(_), found {:?}", e),
}
@@ -312,7 +312,7 @@ mod tests {
#[cfg(feature = "nightly")]
#[bench]
fn giver_queue_throughput(b: &mut test::Bencher) {
use {Body, Request, Response};
use crate::{Body, Request, Response};
let (mut tx, mut rx) = super::channel::<Request<Body>, Response<Body>>();
b.iter(move || {

View File

@@ -89,8 +89,8 @@ use http::{Method, Request, Response, Uri, Version};
use http::header::{HeaderValue, HOST};
use http::uri::Scheme;
use body::{Body, Payload};
use common::{lazy as hyper_lazy, Lazy};
use crate::body::{Body, Payload};
use crate::common::{lazy as hyper_lazy, Lazy};
use self::connect::{Alpn, Connect, Connected, Destination};
use self::pool::{Key as PoolKey, Pool, Poolable, Pooled, Reservation};
@@ -237,7 +237,7 @@ where C: Connect + Sync + 'static,
Version::HTTP_11 => (),
Version::HTTP_10 => if is_http_connect {
warn!("CONNECT is not allowed for HTTP/1.0");
return ResponseFuture::new(Box::new(future::err(::Error::new_user_unsupported_request_method())));
return ResponseFuture::new(Box::new(future::err(crate::Error::new_user_unsupported_request_method())));
},
other_h2 @ Version::HTTP_2 => if self.config.ver != Ver::Http2 {
return ResponseFuture::error_version(other_h2);
@@ -257,7 +257,7 @@ where C: Connect + Sync + 'static,
ResponseFuture::new(Box::new(self.retryably_send_request(req, pool_key)))
}
fn retryably_send_request(&self, req: Request<B>, pool_key: PoolKey) -> impl Future<Item=Response<Body>, Error=::Error> {
fn retryably_send_request(&self, req: Request<B>, pool_key: PoolKey) -> impl Future<Item=Response<Body>, Error=crate::Error> {
let client = self.clone();
let uri = req.uri().clone();
@@ -320,7 +320,7 @@ where C: Connect + Sync + 'static,
};
} else if req.method() == &Method::CONNECT {
debug!("client does not support CONNECT requests over HTTP2");
return Either::A(future::err(ClientError::Normal(::Error::new_user_unsupported_request_method())));
return Either::A(future::err(ClientError::Normal(crate::Error::new_user_unsupported_request_method())));
}
let fut = pooled.send_request_retryable(req)
@@ -478,7 +478,7 @@ where C: Connect + Sync + 'static,
}
fn connect_to(&self, uri: Uri, pool_key: PoolKey)
-> impl Lazy<Item=Pooled<PoolClient<B>>, Error=::Error>
-> impl Lazy<Item=Pooled<PoolClient<B>>, Error=crate::Error>
{
let executor = self.conn_builder.exec.clone();
let pool = self.pool.clone();
@@ -498,12 +498,12 @@ where C: Connect + Sync + 'static,
let connecting = match pool.connecting(&pool_key, ver) {
Some(lock) => lock,
None => {
let canceled = ::Error::new_canceled().with("HTTP/2 connection in progress");
let canceled = crate::Error::new_canceled().with("HTTP/2 connection in progress");
return Either::B(future::err(canceled));
}
};
Either::A(connector.connect(dst)
.map_err(::Error::new_connect)
.map_err(crate::Error::new_connect)
.and_then(move |(io, connected)| {
// If ALPN is h2 and we aren't http2_only already,
// then we need to convert our pool checkout into
@@ -517,7 +517,7 @@ where C: Connect + Sync + 'static,
None => {
// Another connection has already upgraded,
// the pool checkout should finish up for us.
let canceled = ::Error::new_canceled().with("ALPN upgraded to HTTP/2");
let canceled = crate::Error::new_canceled().with("ALPN upgraded to HTTP/2");
return Either::B(future::err(canceled));
}
}
@@ -583,11 +583,11 @@ impl<C, B> fmt::Debug for Client<C, B> {
/// This is returned by `Client::request` (and `Client::get`).
#[must_use = "futures do nothing unless polled"]
pub struct ResponseFuture {
inner: Box<dyn Future<Item=Response<Body>, Error=::Error> + Send>,
inner: Box<dyn Future<Item=Response<Body>, Error=crate::Error> + Send>,
}
impl ResponseFuture {
fn new(fut: Box<dyn Future<Item=Response<Body>, Error=::Error> + Send>) -> Self {
fn new(fut: Box<dyn Future<Item=Response<Body>, Error=crate::Error> + Send>) -> Self {
Self {
inner: fut,
}
@@ -595,7 +595,7 @@ impl ResponseFuture {
fn error_version(ver: Version) -> Self {
warn!("Request has unsupported version \"{:?}\"", ver);
ResponseFuture::new(Box::new(future::err(::Error::new_user_unsupported_version())))
ResponseFuture::new(Box::new(future::err(crate::Error::new_user_unsupported_version())))
}
}
@@ -607,7 +607,7 @@ impl fmt::Debug for ResponseFuture {
impl Future for ResponseFuture {
type Item = Response<Body>;
type Error = ::Error;
type Error = crate::Error;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
self.inner.poll()
@@ -627,7 +627,7 @@ enum PoolTx<B> {
}
impl<B> PoolClient<B> {
fn poll_ready(&mut self) -> Poll<(), ::Error> {
fn poll_ready(&mut self) -> Poll<(), crate::Error> {
match self.tx {
PoolTx::Http1(ref mut tx) => tx.poll_ready(),
PoolTx::Http2(_) => Ok(Async::Ready(())),
@@ -661,7 +661,7 @@ impl<B> PoolClient<B> {
}
impl<B: Payload + 'static> PoolClient<B> {
fn send_request_retryable(&mut self, req: Request<B>) -> impl Future<Item = Response<Body>, Error = (::Error, Option<Request<B>>)>
fn send_request_retryable(&mut self, req: Request<B>) -> impl Future<Item = Response<Body>, Error = (crate::Error, Option<Request<B>>)>
where
B: Send,
{
@@ -713,17 +713,17 @@ where
// FIXME: allow() required due to `impl Trait` leaking types to this lint
#[allow(missing_debug_implementations)]
enum ClientError<B> {
Normal(::Error),
Normal(crate::Error),
Canceled {
connection_reused: bool,
req: Request<B>,
reason: ::Error,
reason: crate::Error,
}
}
impl<B> ClientError<B> {
fn map_with_reused(conn_reused: bool)
-> impl Fn((::Error, Option<Request<B>>)) -> Self
-> impl Fn((crate::Error, Option<Request<B>>)) -> Self
{
move |(err, orig_req)| {
if let Some(req) = orig_req {
@@ -797,7 +797,7 @@ fn authority_form(uri: &mut Uri) {
};
}
fn extract_domain(uri: &mut Uri, is_http_connect: bool) -> ::Result<String> {
fn extract_domain(uri: &mut Uri, is_http_connect: bool) -> crate::Result<String> {
let uri_clone = uri.clone();
match (uri_clone.scheme_part(), uri_clone.authority_part()) {
(Some(scheme), Some(auth)) => {
@@ -819,7 +819,7 @@ fn extract_domain(uri: &mut Uri, is_http_connect: bool) -> ::Result<String> {
},
_ => {
debug!("Client requires absolute-form URIs, received: {:?}", uri);
Err(::Error::new_user_absolute_uri_required())
Err(crate::Error::new_user_absolute_uri_required())
}
}
}

View File

@@ -9,7 +9,7 @@ use futures::sync::oneshot;
#[cfg(feature = "runtime")]
use tokio_timer::Interval;
use common::Exec;
use crate::common::Exec;
use super::Ver;
// FIXME: allow() required due to `impl Trait` leaking types to this lint
@@ -75,7 +75,7 @@ struct PoolInner<T> {
// A oneshot channel is used to allow the interval to be notified when
// the Pool completely drops. That way, the interval can cancel immediately.
#[cfg(feature = "runtime")]
idle_interval_ref: Option<oneshot::Sender<::common::Never>>,
idle_interval_ref: Option<oneshot::Sender<crate::common::Never>>,
#[cfg(feature = "runtime")]
exec: Exec,
timeout: Option<Duration>,
@@ -569,7 +569,7 @@ pub(super) struct Checkout<T> {
}
impl<T: Poolable> Checkout<T> {
fn poll_waiter(&mut self) -> Poll<Option<Pooled<T>>, ::Error> {
fn poll_waiter(&mut self) -> Poll<Option<Pooled<T>>, crate::Error> {
static CANCELED: &str = "pool checkout failed";
if let Some(mut rx) = self.waiter.take() {
match rx.poll() {
@@ -577,14 +577,14 @@ impl<T: Poolable> Checkout<T> {
if value.is_open() {
Ok(Async::Ready(Some(self.pool.reuse(&self.key, value))))
} else {
Err(::Error::new_canceled().with(CANCELED))
Err(crate::Error::new_canceled().with(CANCELED))
}
},
Ok(Async::NotReady) => {
self.waiter = Some(rx);
Ok(Async::NotReady)
},
Err(_canceled) => Err(::Error::new_canceled().with(CANCELED)),
Err(_canceled) => Err(crate::Error::new_canceled().with(CANCELED)),
}
} else {
Ok(Async::Ready(None))
@@ -644,7 +644,7 @@ impl<T: Poolable> Checkout<T> {
impl<T: Poolable> Future for Checkout<T> {
type Item = Pooled<T>;
type Error = ::Error;
type Error = crate::Error;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
if let Some(pooled) = try_ready!(self.poll_waiter()) {
@@ -654,7 +654,7 @@ impl<T: Poolable> Future for Checkout<T> {
if let Some(pooled) = self.checkout() {
Ok(Async::Ready(pooled))
} else if !self.pool.is_enabled() {
Err(::Error::new_canceled().with("pool is disabled"))
Err(crate::Error::new_canceled().with("pool is disabled"))
} else {
Ok(Async::NotReady)
}
@@ -723,7 +723,7 @@ struct IdleInterval<T> {
// This allows the IdleInterval to be notified as soon as the entire
// Pool is fully dropped, and shutdown. This channel is never sent on,
// but Err(Canceled) will be received when the Pool is dropped.
pool_drop_notifier: oneshot::Receiver<::common::Never>,
pool_drop_notifier: oneshot::Receiver<crate::common::Never>,
}
#[cfg(feature = "runtime")]
@@ -783,7 +783,7 @@ mod tests {
use std::time::Duration;
use futures::{Async, Future};
use futures::future;
use common::Exec;
use crate::common::Exec;
use super::{Connecting, Key, Poolable, Pool, Reservation, WeakOpt};
/// Test unique reservations.

View File

@@ -6,7 +6,7 @@ use futures::future::poll_fn;
use futures::sync::oneshot;
use tokio::runtime::current_thread::Runtime;
use mock::MockConnector;
use crate::mock::MockConnector;
use super::*;
#[test]
@@ -20,7 +20,7 @@ fn retryable_request() {
let sock2 = connector.mock("http://mock.local");
let client = Client::builder()
.build::<_, ::Body>(connector);
.build::<_, crate::Body>(connector);
client.pool.no_timer();
@@ -67,7 +67,7 @@ fn conn_reset_after_write() {
let sock1 = connector.mock("http://mock.local");
let client = Client::builder()
.build::<_, ::Body>(connector);
.build::<_, crate::Body>(connector);
client.pool.no_timer();
@@ -119,11 +119,11 @@ fn checkout_win_allows_connect_future_to_be_pooled() {
let sock2 = connector.mock_fut("http://mock.local", rx);
let client = Client::builder()
.build::<_, ::Body>(connector);
.build::<_, crate::Body>(connector);
client.pool.no_timer();
let uri = "http://mock.local/a".parse::<::Uri>().expect("uri parse");
let uri = "http://mock.local/a".parse::<crate::Uri>().expect("uri parse");
// First request just sets us up to have a connection able to be put
// back in the pool. *However*, it doesn't insert immediately. The
@@ -214,7 +214,7 @@ fn bench_http1_get_0b(b: &mut test::Bencher) {
let client = Client::builder()
.build::<_, ::Body>(connector.clone());
.build::<_, crate::Body>(connector.clone());
client.pool.no_timer();
@@ -246,7 +246,7 @@ fn bench_http1_get_10b(b: &mut test::Bencher) {
let client = Client::builder()
.build::<_, ::Body>(connector.clone());
.build::<_, crate::Body>(connector.clone());
client.pool.no_timer();