diff --git a/src/body/incoming.rs b/src/body/incoming.rs index ad5bd16116..76f5cc28db 100644 --- a/src/body/incoming.rs +++ b/src/body/incoming.rs @@ -6,6 +6,7 @@ use std::task::{Context, Poll}; use bytes::Bytes; use futures_channel::mpsc; use futures_channel::oneshot; +use futures_util::ready; use futures_util::{stream::FusedStream, Stream}; // for mpsc::Receiver use http::HeaderMap; use http_body::{Body, Frame, SizeHint}; diff --git a/src/client/conn/http1.rs b/src/client/conn/http1.rs index c487b1927a..f9f9e77b98 100644 --- a/src/client/conn/http1.rs +++ b/src/client/conn/http1.rs @@ -8,6 +8,7 @@ use std::task::{Context, Poll}; use crate::rt::{Read, Write}; use bytes::Bytes; +use futures_util::ready; use http::{Request, Response}; use httparse::ParserConfig; diff --git a/src/client/conn/http2.rs b/src/client/conn/http2.rs index ec8ecf3e08..dec10eabaa 100644 --- a/src/client/conn/http2.rs +++ b/src/client/conn/http2.rs @@ -10,6 +10,7 @@ use std::task::{Context, Poll}; use std::time::Duration; use crate::rt::{Read, Write}; +use futures_util::ready; use http::{Request, Response}; use super::super::dispatch; diff --git a/src/common/mod.rs b/src/common/mod.rs index 4129673cdc..a89753a8c4 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -1,12 +1,3 @@ -macro_rules! ready { - ($e:expr) => { - match $e { - std::task::Poll::Ready(v) => v, - std::task::Poll::Pending => return std::task::Poll::Pending, - } - }; -} - #[cfg(all(any(feature = "client", feature = "server"), feature = "http1"))] pub(crate) mod buf; #[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))] diff --git a/src/lib.rs b/src/lib.rs index 0d1db8320a..2648c0ebeb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,9 +84,8 @@ mod cfg; #[macro_use] mod trace; -#[macro_use] -mod common; pub mod body; +mod common; mod error; pub mod ext; #[cfg(test)] diff --git a/src/proto/h1/conn.rs b/src/proto/h1/conn.rs index 43fba3b793..0a73883ad3 100644 --- a/src/proto/h1/conn.rs +++ b/src/proto/h1/conn.rs @@ -8,6 +8,7 @@ use std::time::Duration; use crate::rt::{Read, Write}; use bytes::{Buf, Bytes}; +use futures_util::ready; use http::header::{HeaderValue, CONNECTION}; use http::{HeaderMap, Method, Version}; use httparse::ParserConfig; diff --git a/src/proto/h1/decode.rs b/src/proto/h1/decode.rs index 9c7b4b39d1..74d8f70af1 100644 --- a/src/proto/h1/decode.rs +++ b/src/proto/h1/decode.rs @@ -5,6 +5,7 @@ use std::task::{Context, Poll}; use std::usize; use bytes::Bytes; +use futures_util::ready; use super::io::MemRead; use super::DecodedLength; diff --git a/src/proto/h1/dispatch.rs b/src/proto/h1/dispatch.rs index 7190959cd7..c55c28c906 100644 --- a/src/proto/h1/dispatch.rs +++ b/src/proto/h1/dispatch.rs @@ -8,6 +8,7 @@ use std::{ use crate::rt::{Read, Write}; use bytes::{Buf, Bytes}; +use futures_util::ready; use http::Request; use super::{Http1Transaction, Wants}; diff --git a/src/proto/h1/io.rs b/src/proto/h1/io.rs index 3827e4ed15..417119ef11 100644 --- a/src/proto/h1/io.rs +++ b/src/proto/h1/io.rs @@ -10,6 +10,7 @@ use std::task::{Context, Poll}; use crate::rt::{Read, ReadBuf, Write}; use bytes::{Buf, BufMut, Bytes, BytesMut}; +use futures_util::ready; use super::{Http1Transaction, ParseContext, ParsedMessage}; use crate::common::buf::BufList; diff --git a/src/proto/h2/client.rs b/src/proto/h2/client.rs index f25ce1a4e0..97311f6147 100644 --- a/src/proto/h2/client.rs +++ b/src/proto/h2/client.rs @@ -12,6 +12,7 @@ use bytes::Bytes; use futures_channel::mpsc::{Receiver, Sender}; use futures_channel::{mpsc, oneshot}; use futures_util::future::{Either, FusedFuture, FutureExt as _}; +use futures_util::ready; use futures_util::stream::{StreamExt as _, StreamFuture}; use h2::client::{Builder, Connection, SendRequest}; use h2::SendStream; diff --git a/src/proto/h2/mod.rs b/src/proto/h2/mod.rs index 15afe48d23..b344f84cbb 100644 --- a/src/proto/h2/mod.rs +++ b/src/proto/h2/mod.rs @@ -6,6 +6,7 @@ use std::pin::Pin; use std::task::{Context, Poll}; use bytes::{Buf, Bytes}; +use futures_util::ready; use h2::{Reason, RecvStream, SendStream}; use http::header::{HeaderName, CONNECTION, TE, TRAILER, TRANSFER_ENCODING, UPGRADE}; use http::HeaderMap; diff --git a/src/proto/h2/server.rs b/src/proto/h2/server.rs index 0337e22ea8..fa9680d9bf 100644 --- a/src/proto/h2/server.rs +++ b/src/proto/h2/server.rs @@ -6,6 +6,7 @@ use std::task::{Context, Poll}; use std::time::Duration; use bytes::Bytes; +use futures_util::ready; use h2::server::{Connection, Handshake, SendResponse}; use h2::{Reason, RecvStream}; use http::{Method, Request}; diff --git a/src/server/conn/http1.rs b/src/server/conn/http1.rs index d4b8924e9f..24bebfd292 100644 --- a/src/server/conn/http1.rs +++ b/src/server/conn/http1.rs @@ -11,6 +11,7 @@ use std::time::Duration; use crate::rt::{Read, Write}; use bytes::Bytes; +use futures_util::ready; use crate::body::{Body, Incoming as IncomingBody}; use crate::proto; diff --git a/src/server/conn/http2.rs b/src/server/conn/http2.rs index e412f0001f..df04bc473d 100644 --- a/src/server/conn/http2.rs +++ b/src/server/conn/http2.rs @@ -10,6 +10,7 @@ use std::task::{Context, Poll}; use std::time::Duration; use crate::rt::{Read, Write}; +use futures_util::ready; use pin_project_lite::pin_project; use crate::body::{Body, Incoming as IncomingBody};