diff --git a/.travis.yml b/.travis.yml index eb5b8d45..6baedc9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ matrix: - rust: stable env: FEATURES="--no-default-features" # Minimum Supported Rust Version - - rust: 1.26.0 + - rust: 1.27.0 env: FEATURES="--no-default-features --features runtime" BUILD_ONLY="1" before_script: diff --git a/examples/echo.rs b/examples/echo.rs index 93b620c6..4feca052 100644 --- a/examples/echo.rs +++ b/examples/echo.rs @@ -1,3 +1,4 @@ +#![deny(warnings)] extern crate futures; extern crate hyper; @@ -12,7 +13,7 @@ use hyper::{Body, Method, Request, Response, Server, StatusCode}; /// /// A boxed Future (trait object) is used as it is easier to understand /// and extend with more types. Advanced users could switch to `Either`. -type BoxFut = Box, Error = hyper::Error> + Send>; +type BoxFut = Box, Error = hyper::Error> + Send>; /// This is our service handler. It receives a Request, routes on its /// path, and returns a Future of a Response. diff --git a/examples/params.rs b/examples/params.rs index 5c057bb8..511e27bf 100644 --- a/examples/params.rs +++ b/examples/params.rs @@ -17,7 +17,7 @@ static MISSING: &[u8] = b"Missing field"; static NOTNUMERIC: &[u8] = b"Number field is not numeric"; // Using service_fn, we can turn this function into a `Service`. -fn param_example(req: Request) -> Box, Error=hyper::Error> + Send> { +fn param_example(req: Request) -> Box, Error=hyper::Error> + Send> { match (req.method(), req.uri().path()) { (&Method::GET, "/") | (&Method::GET, "/post") => { Box::new(future::ok(Response::new(INDEX.into()))) diff --git a/examples/send_file.rs b/examples/send_file.rs index e2eeefd2..08c30513 100644 --- a/examples/send_file.rs +++ b/examples/send_file.rs @@ -30,7 +30,7 @@ fn main() { hyper::rt::run(server); } -type ResponseFuture = Box, Error=io::Error> + Send>; +type ResponseFuture = Box, Error=io::Error> + Send>; fn response_examples(req: Request) -> ResponseFuture { match (req.method(), req.uri().path()) { diff --git a/examples/web_api.rs b/examples/web_api.rs index af2a6309..32f02ee2 100644 --- a/examples/web_api.rs +++ b/examples/web_api.rs @@ -16,7 +16,7 @@ static INDEX: &[u8] = b"test.html"; static POST_DATA: &str = r#"{"original": "data"}"#; type GenericError = Box; -type ResponseFuture = Box, Error=GenericError> + Send>; +type ResponseFuture = Box, Error=GenericError> + Send>; fn client_request_response(client: &Client) -> ResponseFuture { let req = Request::builder() diff --git a/src/body/body.rs b/src/body/body.rs index cf88c9f2..00da58c5 100644 --- a/src/body/body.rs +++ b/src/body/body.rs @@ -1,4 +1,5 @@ use std::borrow::Cow; +use std::error::Error as StdError; use std::fmt; use bytes::Bytes; @@ -39,7 +40,7 @@ enum Kind { content_length: Option, recv: h2::RecvStream, }, - Wrapped(Box> + Send>), + Wrapped(Box> + Send>), } struct Extra { @@ -141,7 +142,7 @@ impl Body { pub fn wrap_stream(stream: S) -> Body where S: Stream + Send + 'static, - S::Error: Into>, + S::Error: Into>, Chunk: From, { let mapped = stream.map(Chunk::from).map_err(Into::into); @@ -457,13 +458,13 @@ impl From for Body { } impl - From> + Send + 'static>> + From> + Send + 'static>> for Body { #[inline] fn from( stream: Box< - Stream> + Send + 'static, + dyn Stream> + Send + 'static, >, ) -> Body { Body::new(Kind::Wrapped(stream)) diff --git a/src/body/payload.rs b/src/body/payload.rs index 53bb4451..0eaa6419 100644 --- a/src/body/payload.rs +++ b/src/body/payload.rs @@ -1,3 +1,5 @@ +use std::error::Error as StdError; + use bytes::Buf; use futures::{Async, Poll}; use http::HeaderMap; @@ -13,7 +15,7 @@ pub trait Payload: Send + 'static { type Data: Buf + Send; /// The error type of this stream. - type Error: Into>; + type Error: Into>; /// Poll for a `Data` buffer. /// diff --git a/src/client/conn.rs b/src/client/conn.rs index 0d9f297d..b7a502e5 100644 --- a/src/client/conn.rs +++ b/src/client/conn.rs @@ -98,7 +98,7 @@ pub struct Handshake { pub struct ResponseFuture { // for now, a Box is used to hide away the internal `B` // that can be returned if canceled - inner: Box, Error=::Error> + Send>, + inner: Box, Error=::Error> + Send>, } /// Deconstructed parts of a `Connection`. @@ -464,7 +464,7 @@ impl Builder { /// Provide an executor to execute background HTTP2 tasks. pub fn executor(&mut self, exec: E) -> &mut Builder where - E: Executor + Send>> + Send + Sync + 'static, + E: Executor + Send>> + Send + Sync + 'static, { self.exec = Exec::Executor(Arc::new(exec)); self diff --git a/src/client/connect/dns.rs b/src/client/connect/dns.rs index fa7db2af..28a7f2aa 100644 --- a/src/client/connect/dns.rs +++ b/src/client/connect/dns.rs @@ -184,7 +184,7 @@ impl fmt::Debug for GaiAddrs { } #[derive(Clone)] -struct GaiExecutor(Arc + Send + Sync>); +struct GaiExecutor(Arc + Send + Sync>); impl Executor> for GaiExecutor { fn execute(&self, future: oneshot::Execute) -> Result<(), ExecuteError>> { diff --git a/src/client/connect/mod.rs b/src/client/connect/mod.rs index ea04ffa0..4d16843b 100644 --- a/src/client/connect/mod.rs +++ b/src/client/connect/mod.rs @@ -27,7 +27,7 @@ pub trait Connect: Send + Sync { /// The connected IO Stream. type Transport: AsyncRead + AsyncWrite + Send + 'static; /// An error occured when trying to connect. - type Error: Into>; + type Error: Into>; /// A Future that will resolve to the connected Transport. type Future: Future + Send; /// Connect to a destination. @@ -53,7 +53,7 @@ pub struct Connected { pub(super) extra: Option, } -pub(super) struct Extra(Box); +pub(super) struct Extra(Box); #[derive(Clone, Copy, Debug, PartialEq)] pub(super) enum Alpn { @@ -344,7 +344,7 @@ impl fmt::Debug for Extra { } trait ExtraInner: Send + Sync { - fn clone_box(&self) -> Box; + fn clone_box(&self) -> Box; fn set(&self, res: &mut Response<::Body>); } @@ -358,7 +358,7 @@ impl ExtraInner for ExtraEnvelope where T: Clone + Send + Sync + 'static { - fn clone_box(&self) -> Box { + fn clone_box(&self) -> Box { Box::new(self.clone()) } @@ -367,7 +367,7 @@ where } } -struct ExtraChain(Box, T); +struct ExtraChain(Box, T); impl Clone for ExtraChain { fn clone(&self) -> Self { @@ -379,7 +379,7 @@ impl ExtraInner for ExtraChain where T: Clone + Send + Sync + 'static { - fn clone_box(&self) -> Box { + fn clone_box(&self) -> Box { Box::new(self.clone()) } diff --git a/src/client/mod.rs b/src/client/mod.rs index 80e16b2e..3ad159b2 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -583,11 +583,11 @@ impl fmt::Debug for Client { /// This is returned by `Client::request` (and `Client::get`). #[must_use = "futures do nothing unless polled"] pub struct ResponseFuture { - inner: Box, Error=::Error> + Send>, + inner: Box, Error=::Error> + Send>, } impl ResponseFuture { - fn new(fut: Box, Error=::Error> + Send>) -> Self { + fn new(fut: Box, Error=::Error> + Send>) -> Self { Self { inner: fut, } @@ -1030,7 +1030,7 @@ impl Builder { /// Provide an executor to execute background `Connection` tasks. pub fn executor(&mut self, exec: E) -> &mut Self where - E: Executor + Send>> + Send + Sync + 'static, + E: Executor + Send>> + Send + Sync + 'static, { self.conn_builder.executor(exec); self diff --git a/src/common/exec.rs b/src/common/exec.rs index a5a85ba3..4c2d489b 100644 --- a/src/common/exec.rs +++ b/src/common/exec.rs @@ -21,7 +21,7 @@ pub trait NewSvcExec>: Clone { #[derive(Clone)] pub enum Exec { Default, - Executor(Arc + Send>> + Send + Sync>), + Executor(Arc + Send>> + Send + Sync>), } // ===== impl Exec ===== diff --git a/src/error.rs b/src/error.rs index 2404c582..251d8671 100644 --- a/src/error.rs +++ b/src/error.rs @@ -10,7 +10,7 @@ use h2; /// Result type often returned from methods that can have hyper `Error`s. pub type Result = ::std::result::Result; -type Cause = Box; +type Cause = Box; /// Represents errors that can occur handling HTTP streams. pub struct Error { @@ -135,12 +135,12 @@ impl Error { #[doc(hidden)] #[cfg_attr(error_source, deprecated(note = "use Error::source instead"))] - pub fn cause2(&self) -> Option<&(StdError + 'static + Sync + Send)> { + pub fn cause2(&self) -> Option<&(dyn StdError + 'static + Sync + Send)> { self.inner.cause.as_ref().map(|e| &**e) } /// Consumes the error, returning its cause. - pub fn into_cause(self) -> Option> { + pub fn into_cause(self) -> Option> { self.inner.cause } @@ -380,12 +380,12 @@ impl StdError for Error { } #[cfg(error_source)] - fn source(&self) -> Option<&(StdError + 'static)> { + fn source(&self) -> Option<&(dyn StdError + 'static)> { self .inner .cause .as_ref() - .map(|cause| &**cause as &(StdError + 'static)) + .map(|cause| &**cause as &(dyn StdError + 'static)) } } diff --git a/src/mock.rs b/src/mock.rs index 6f7cb6d1..8c3dad3f 100644 --- a/src/mock.rs +++ b/src/mock.rs @@ -435,7 +435,7 @@ impl Drop for DuplexHandle { } #[cfg(feature = "runtime")] -type BoxedConnectFut = Box + Send>; +type BoxedConnectFut = Box + Send>; #[cfg(feature = "runtime")] #[derive(Clone)] diff --git a/src/proto/h1/decode.rs b/src/proto/h1/decode.rs index b8e2cac7..c89ffcdc 100644 --- a/src/proto/h1/decode.rs +++ b/src/proto/h1/decode.rs @@ -186,15 +186,15 @@ impl ChunkedState { trace!("Read chunk hex size"); let radix = 16; match byte!(rdr) { - b @ b'0'...b'9' => { + b @ b'0'..=b'9' => { *size *= radix; *size += (b - b'0') as u64; } - b @ b'a'...b'f' => { + b @ b'a'..=b'f' => { *size *= radix; *size += (b + 10 - b'a') as u64; } - b @ b'A'...b'F' => { + b @ b'A'..=b'F' => { *size *= radix; *size += (b + 10 - b'A') as u64; } diff --git a/src/proto/h1/dispatch.rs b/src/proto/h1/dispatch.rs index df4d0137..da2d600c 100644 --- a/src/proto/h1/dispatch.rs +++ b/src/proto/h1/dispatch.rs @@ -1,3 +1,5 @@ +use std::error::Error as StdError; + use bytes::{Buf, Bytes}; use futures::{Async, Future, Poll, Stream}; use http::{Request, Response, StatusCode}; @@ -44,7 +46,7 @@ type ClientRx = ::client::dispatch::Receiver, Response>; impl Dispatcher where D: Dispatch, PollBody=Bs, RecvItem=MessageHead>, - D::PollError: Into>, + D::PollError: Into>, I: AsyncRead + AsyncWrite, T: Http1Transaction, Bs: Payload, @@ -334,7 +336,7 @@ where impl Future for Dispatcher where D: Dispatch, PollBody=Bs, RecvItem=MessageHead>, - D::PollError: Into>, + D::PollError: Into>, I: AsyncRead + AsyncWrite, T: Http1Transaction, Bs: Payload, @@ -365,7 +367,7 @@ impl Server where S: Service { impl Dispatch for Server where S: Service, - S::Error: Into>, + S::Error: Into>, Bs: Payload, { type PollItem = MessageHead; diff --git a/src/proto/h1/role.rs b/src/proto/h1/role.rs index 937b23d9..890fe7c9 100644 --- a/src/proto/h1/role.rs +++ b/src/proto/h1/role.rs @@ -717,7 +717,7 @@ impl Client { 101 => { return Ok(Some((DecodedLength::ZERO, true))); }, - 100...199 => { + 100..=199 => { trace!("ignoring informational response: {}", inc.subject.as_u16()); return Ok(None); }, @@ -729,7 +729,7 @@ impl Client { Some(Method::HEAD) => { return Ok(Some((DecodedLength::ZERO, false))); } - Some(Method::CONNECT) => if let 200...299 = inc.subject.as_u16() { + Some(Method::CONNECT) => if let 200..=299 = inc.subject.as_u16() { return Ok(Some((DecodedLength::ZERO, true))); } Some(_) => {}, diff --git a/src/proto/h2/server.rs b/src/proto/h2/server.rs index 28a3de65..3d21d193 100644 --- a/src/proto/h2/server.rs +++ b/src/proto/h2/server.rs @@ -1,3 +1,5 @@ +use std::error::Error as StdError; + use futures::{Async, Future, Poll, Stream}; use h2::Reason; use h2::server::{Builder, Connection, Handshake, SendResponse}; @@ -46,7 +48,7 @@ impl Server where T: AsyncRead + AsyncWrite, S: Service, - S::Error: Into>, + S::Error: Into>, B: Payload, E: H2Exec, { @@ -83,7 +85,7 @@ impl Future for Server where T: AsyncRead + AsyncWrite, S: Service, - S::Error: Into>, + S::Error: Into>, B: Payload, E: H2Exec, { @@ -126,7 +128,7 @@ where ReqBody=Body, ResBody=B, >, - S::Error: Into>, + S::Error: Into>, E: H2Exec, { if self.closing.is_none() { @@ -203,7 +205,7 @@ where impl H2Stream where F: Future>, - F::Error: Into>, + F::Error: Into>, B: Payload, { fn new(fut: F, respond: SendResponse>) -> H2Stream { @@ -296,7 +298,7 @@ where impl Future for H2Stream where F: Future>, - F::Error: Into>, + F::Error: Into>, B: Payload, { type Item = (); diff --git a/src/server/conn.rs b/src/server/conn.rs index 5132ac8a..ad6a2e8e 100644 --- a/src/server/conn.rs +++ b/src/server/conn.rs @@ -8,6 +8,7 @@ //! If you don't have need to manage connections yourself, consider using the //! higher-level [Server](super) API. +use std::error::Error as StdError; use std::fmt; use std::mem; #[cfg(feature = "runtime")] use std::net::SocketAddr; @@ -179,7 +180,7 @@ impl Http { #[deprecated(note = "use Http::with_executor instead")] pub fn executor(&mut self, exec: E) -> &mut Self where - E: Executor + Send>> + Send + Sync + 'static + E: Executor + Send>> + Send + Sync + 'static { self.exec = Exec::Executor(Arc::new(exec)); self @@ -364,7 +365,7 @@ impl Http { pub fn serve_connection(&self, io: I, service: S) -> Connection where S: Service, - S::Error: Into>, + S::Error: Into>, Bd: Payload, I: AsyncRead + AsyncWrite, E: H2Exec, @@ -419,7 +420,7 @@ impl Http { ReqBody=Body, ResBody=Bd, >, - S::Error: Into>, + S::Error: Into>, Bd: Payload, E: H2Exec<::Future, Bd>, { @@ -444,7 +445,7 @@ impl Http { ReqBody=Body, ResBody=Bd, >, - S::Error: Into>, + S::Error: Into>, Bd: Payload, E: H2Exec<::Future, Bd>, { @@ -459,14 +460,14 @@ impl Http { pub fn serve_incoming(&self, incoming: I, make_service: S) -> Serve where I: Stream, - I::Error: Into>, + I::Error: Into>, I::Item: AsyncRead + AsyncWrite, S: MakeServiceRef< I::Item, ReqBody=Body, ResBody=Bd, >, - S::Error: Into>, + S::Error: Into>, Bd: Payload, E: H2Exec<::Future, Bd>, { @@ -484,7 +485,7 @@ impl Http { impl Connection where S: Service, - S::Error: Into>, + S::Error: Into>, I: AsyncRead + AsyncWrite, B: Payload + 'static, E: H2Exec, @@ -622,7 +623,7 @@ where impl Future for Connection where S: Service + 'static, - S::Error: Into>, + S::Error: Into>, I: AsyncRead + AsyncWrite + 'static, B: Payload + 'static, E: H2Exec, @@ -692,10 +693,10 @@ impl Stream for Serve where I: Stream, I::Item: AsyncRead + AsyncWrite, - I::Error: Into>, + I::Error: Into>, S: MakeServiceRef, - //S::Error2: Into>, - //SME: Into>, + //S::Error2: Into>, + //SME: Into>, B: Payload, E: H2Exec<::Future, B>, { @@ -763,7 +764,7 @@ impl SpawnAll { impl SpawnAll where I: Stream, - I::Error: Into>, + I::Error: Into>, I::Item: AsyncRead + AsyncWrite + Send + 'static, S: MakeServiceRef< I::Item, @@ -790,6 +791,7 @@ where } pub(crate) mod spawn_all { + use std::error::Error as StdError; use futures::{Future, Poll}; use tokio_io::{AsyncRead, AsyncWrite}; @@ -860,7 +862,7 @@ pub(crate) mod spawn_all { where I: AsyncRead + AsyncWrite + Send + 'static, N: Future, - N::Error: Into>, + N::Error: Into>, S: Service, B: Payload, E: H2Exec, @@ -916,7 +918,7 @@ mod upgrades { impl UpgradeableConnection where S: Service,// + 'static, - S::Error: Into>, + S::Error: Into>, I: AsyncRead + AsyncWrite, B: Payload + 'static, E: H2Exec, @@ -933,7 +935,7 @@ mod upgrades { impl Future for UpgradeableConnection where S: Service + 'static, - S::Error: Into>, + S::Error: Into>, I: AsyncRead + AsyncWrite + Send + 'static, B: Payload + 'static, E: super::H2Exec, diff --git a/src/server/mod.rs b/src/server/mod.rs index 459f17d5..b55af698 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -54,6 +54,7 @@ pub mod conn; mod shutdown; #[cfg(feature = "runtime")] mod tcp; +use std::error::Error as StdError; use std::fmt; #[cfg(feature = "runtime")] use std::net::{SocketAddr, TcpListener as StdTcpListener}; @@ -142,10 +143,10 @@ impl Server { impl Server where I: Stream, - I::Error: Into>, + I::Error: Into>, I::Item: AsyncRead + AsyncWrite + Send + 'static, S: MakeServiceRef, - S::Error: Into>, + S::Error: Into>, S::Service: 'static, B: Payload, E: H2Exec<::Future, B>, @@ -201,10 +202,10 @@ where impl Future for Server where I: Stream, - I::Error: Into>, + I::Error: Into>, I::Item: AsyncRead + AsyncWrite + Send + 'static, S: MakeServiceRef, - S::Error: Into>, + S::Error: Into>, S::Service: 'static, B: Payload, E: H2Exec<::Future, B>, @@ -398,10 +399,10 @@ impl Builder { pub fn serve(self, new_service: S) -> Server where I: Stream, - I::Error: Into>, + I::Error: Into>, I::Item: AsyncRead + AsyncWrite + Send + 'static, S: MakeServiceRef, - S::Error: Into>, + S::Error: Into>, S::Service: 'static, B: Payload, E: NewSvcExec, diff --git a/src/server/shutdown.rs b/src/server/shutdown.rs index 4d464e61..07ab6874 100644 --- a/src/server/shutdown.rs +++ b/src/server/shutdown.rs @@ -1,3 +1,5 @@ +use std::error::Error as StdError; + use futures::{Async, Future, Stream, Poll}; use tokio_io::{AsyncRead, AsyncWrite}; @@ -38,11 +40,11 @@ impl Graceful { impl Future for Graceful where I: Stream, - I::Error: Into>, + I::Error: Into>, I::Item: AsyncRead + AsyncWrite + Send + 'static, S: MakeServiceRef, S::Service: 'static, - S::Error: Into>, + S::Error: Into>, B: Payload, F: Future, E: H2Exec<::Future, B>, @@ -109,7 +111,7 @@ where fn on_drain(conn: &mut UpgradeableConnection) where S: Service, - S::Error: Into>, + S::Error: Into>, I: AsyncRead + AsyncWrite, S::ResBody: Payload + 'static, E: H2Exec, diff --git a/src/service/make_service.rs b/src/service/make_service.rs index 5aed0b21..d5c7e477 100644 --- a/src/service/make_service.rs +++ b/src/service/make_service.rs @@ -15,7 +15,7 @@ pub trait MakeService { type ResBody: Payload; /// The error type that can be returned by `Service`s. - type Error: Into>; + type Error: Into>; /// The resolved `Service` from `new_service()`. type Service: Service< @@ -28,7 +28,7 @@ pub trait MakeService { type Future: Future; /// The error type that can be returned when creating a new `Service`. - type MakeError: Into>; + type MakeError: Into>; /// Returns `Ready` when the constructor is ready to create a new `Service`. /// @@ -49,13 +49,13 @@ pub trait MakeService { pub trait MakeServiceRef: self::sealed::Sealed { type ReqBody: Payload; type ResBody: Payload; - type Error: Into>; + type Error: Into>; type Service: Service< ReqBody=Self::ReqBody, ResBody=Self::ResBody, Error=Self::Error, >; - type MakeError: Into>; + type MakeError: Into>; type Future: Future; // Acting like a #[non_exhaustive] for associated types of this trait. @@ -77,8 +77,8 @@ pub trait MakeServiceRef: self::sealed::Sealed { impl MakeServiceRef for T where T: for<'a> MakeService<&'a Ctx, Error=E, MakeError=ME, Service=S, Future=F, ReqBody=IB, ResBody=OB>, - E: Into>, - ME: Into>, + E: Into>, + ME: Into>, S: Service, F: Future, IB: Payload, @@ -105,8 +105,8 @@ where impl self::sealed::Sealed for T where T: for<'a> MakeService<&'a Ctx, Error=E, MakeError=ME, Service=S, Future=F, ReqBody=IB, ResBody=OB>, - E: Into>, - ME: Into>, + E: Into>, + ME: Into>, S: Service, F: Future, IB: Payload, @@ -166,7 +166,7 @@ where F: FnMut(&Ctx) -> Ret, Ret: IntoFuture, Ret::Item: Service, - Ret::Error: Into>, + Ret::Error: Into>, ReqBody: Payload, ResBody: Payload, { diff --git a/src/service/new_service.rs b/src/service/new_service.rs index e8c121b0..79873c5a 100644 --- a/src/service/new_service.rs +++ b/src/service/new_service.rs @@ -14,7 +14,7 @@ pub trait NewService { type ResBody: Payload; /// The error type that can be returned by `Service`s. - type Error: Into>; + type Error: Into>; /// The resolved `Service` from `new_service()`. type Service: Service< @@ -27,7 +27,7 @@ pub trait NewService { type Future: Future; /// The error type that can be returned when creating a new `Service`. - type InitError: Into>; + type InitError: Into>; #[doc(hidden)] fn poll_ready(&mut self) -> Poll<(), Self::InitError> { @@ -42,7 +42,7 @@ impl NewService for F where F: Fn() -> R, R: IntoFuture, - R::Error: Into>, + R::Error: Into>, S: Service, { type ReqBody = S::ReqBody; diff --git a/src/service/service.rs b/src/service/service.rs index 93cf469a..41d47bd0 100644 --- a/src/service/service.rs +++ b/src/service/service.rs @@ -21,7 +21,7 @@ pub trait Service { /// Note: Returning an `Error` to a hyper server will cause the connection /// to be abruptly aborted. In most cases, it is better to return a `Response` /// with a 4xx or 5xx status code. - type Error: Into>; + type Error: Into>; /// The `Future` returned by this `Service`. type Future: Future, Error=Self::Error>; @@ -104,7 +104,7 @@ where F: FnMut(Request) -> Ret, ReqBody: Payload, Ret: IntoFuture>, - Ret::Error: Into>, + Ret::Error: Into>, ResBody: Payload, { type ReqBody = ReqBody; diff --git a/src/upgrade.rs b/src/upgrade.rs index d649d251..63646fb2 100644 --- a/src/upgrade.rs +++ b/src/upgrade.rs @@ -26,7 +26,7 @@ use common::io::Rewind; /// Alternatively, if the exact type is known, this can be deconstructed /// into its parts. pub struct Upgraded { - io: Rewind>, + io: Rewind>, } /// A future for a possible HTTP upgrade. @@ -85,7 +85,7 @@ pub(crate) trait Io: AsyncRead + AsyncWrite + 'static { } } -impl Io + Send { +impl dyn Io + Send { fn __hyper_is(&self) -> bool { let t = TypeId::of::(); self.__hyper_type_id() == t @@ -95,7 +95,7 @@ impl Io + Send { if self.__hyper_is::() { // Taken from `std::error::Error::downcast()`. unsafe { - let raw: *mut Io = Box::into_raw(self); + let raw: *mut dyn Io = Box::into_raw(self); Ok(Box::from_raw(raw as *mut T)) } } else { @@ -109,7 +109,7 @@ impl Io for T {} // ===== impl Upgraded ===== impl Upgraded { - pub(crate) fn new(io: Box, read_buf: Bytes) -> Self { + pub(crate) fn new(io: Box, read_buf: Bytes) -> Self { Upgraded { io: Rewind::new_buffered(io, read_buf), } diff --git a/tests/client.rs b/tests/client.rs index 7ca32cc5..54d7e1d6 100644 --- a/tests/client.rs +++ b/tests/client.rs @@ -1565,7 +1565,7 @@ mod dispatch_impl { impl Connect for DebugConnector { type Transport = DebugStream; type Error = io::Error; - type Future = Box + Send>; + type Future = Box + Send>; fn connect(&self, dst: Destination) -> Self::Future { self.connects.fetch_add(1, Ordering::SeqCst); @@ -2178,7 +2178,7 @@ mod conn { } trait FutureHyperExt: Future { - fn expect(self, msg: &'static str) -> Box>; + fn expect(self, msg: &'static str) -> Box>; } impl FutureHyperExt for F @@ -2186,7 +2186,7 @@ where F: Future + 'static, F::Error: ::std::fmt::Debug, { - fn expect(self, msg: &'static str) -> Box> { + fn expect(self, msg: &'static str) -> Box> { Box::new(self.map_err(move |e| panic!("expect: {}; error={:?}", msg, e))) } } diff --git a/tests/server.rs b/tests/server.rs index de356435..b695c41b 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -1779,7 +1779,7 @@ impl Serve { } } -type BoxError = Box<::std::error::Error + Send + Sync>; +type BoxError = Box; struct ReplyBuilder<'a> { tx: &'a spmc::Sender, @@ -1853,7 +1853,7 @@ enum Msg { } impl TestService { - fn call(&self, req: Request) -> Box, Error=BoxError> + Send> { + fn call(&self, req: Request) -> Box, Error=BoxError> + Send> { let tx1 = self.tx.clone(); let tx2 = self.tx.clone(); let replies = self.reply.clone(); diff --git a/tests/support/mod.rs b/tests/support/mod.rs index ab8cc660..96d8e5ad 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -212,7 +212,7 @@ macro_rules! __internal_headers_eq { $pat => (), other => panic!("headers[{}] was not {}: {:?}", stringify!($name), stringify!($pat), other), } - }) as ::std::sync::Arc + }) as ::std::sync::Arc }; (@val $name: expr, NONE) => { __internal_headers_eq!(@pat $name, None); @@ -228,7 +228,7 @@ macro_rules! __internal_headers_eq { } else { assert_eq!(__hdrs.get($name), None, stringify!($name)); } - }) as ::std::sync::Arc + }) as ::std::sync::Arc }); ($headers:ident, { $($name:expr => $val:tt,)* }) => { $( @@ -289,7 +289,7 @@ pub struct __SRes { pub headers: HeaderMap, } -pub type __HeadersEq = Vec>; +pub type __HeadersEq = Vec>; pub struct __TestConfig { pub client_version: usize, @@ -426,7 +426,7 @@ pub fn __run_test(cfg: __TestConfig) { }); - let client_futures: Box + Send> = if cfg.parallel { + let client_futures: Box + Send> = if cfg.parallel { let mut client_futures = vec![]; for (creq, cres) in cfg.client_msgs { client_futures.push(make_request(&client, creq, cres)); @@ -434,7 +434,7 @@ pub fn __run_test(cfg: __TestConfig) { drop(client); Box::new(future::join_all(client_futures).map(|_| ())) } else { - let mut client_futures: Box, Error=()> + Send> = + let mut client_futures: Box, Error=()> + Send> = Box::new(future::ok(client)); for (creq, cres) in cfg.client_msgs { let mk_request = make_request.clone();