chore(lib): add dyn keyword to trait objects (#1820)

Requires Rust 1.27.
This commit is contained in:
Sean McArthur
2019-06-03 13:08:13 -07:00
committed by GitHub
parent e0f5a9c6c5
commit 01c03db7ea
28 changed files with 107 additions and 94 deletions

View File

@@ -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;
}

View File

@@ -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<B> = ::client::dispatch::Receiver<Request<B>, Response<Body>>;
impl<D, Bs, I, T> Dispatcher<D, Bs, I, T>
where
D: Dispatch<PollItem=MessageHead<T::Outgoing>, PollBody=Bs, RecvItem=MessageHead<T::Incoming>>,
D::PollError: Into<Box<::std::error::Error + Send + Sync>>,
D::PollError: Into<Box<dyn StdError + Send + Sync>>,
I: AsyncRead + AsyncWrite,
T: Http1Transaction,
Bs: Payload,
@@ -334,7 +336,7 @@ where
impl<D, Bs, I, T> Future for Dispatcher<D, Bs, I, T>
where
D: Dispatch<PollItem=MessageHead<T::Outgoing>, PollBody=Bs, RecvItem=MessageHead<T::Incoming>>,
D::PollError: Into<Box<::std::error::Error + Send + Sync>>,
D::PollError: Into<Box<dyn StdError + Send + Sync>>,
I: AsyncRead + AsyncWrite,
T: Http1Transaction,
Bs: Payload,
@@ -365,7 +367,7 @@ impl<S> Server<S> where S: Service {
impl<S, Bs> Dispatch for Server<S>
where
S: Service<ReqBody=Body, ResBody=Bs>,
S::Error: Into<Box<::std::error::Error + Send + Sync>>,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
Bs: Payload,
{
type PollItem = MessageHead<StatusCode>;

View File

@@ -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(_) => {},

View File

@@ -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<T, S, B, E> Server<T, S, B, E>
where
T: AsyncRead + AsyncWrite,
S: Service<ReqBody=Body, ResBody=B>,
S::Error: Into<Box<::std::error::Error + Send + Sync>>,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
B: Payload,
E: H2Exec<S::Future, B>,
{
@@ -83,7 +85,7 @@ impl<T, S, B, E> Future for Server<T, S, B, E>
where
T: AsyncRead + AsyncWrite,
S: Service<ReqBody=Body, ResBody=B>,
S::Error: Into<Box<::std::error::Error + Send + Sync>>,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
B: Payload,
E: H2Exec<S::Future, B>,
{
@@ -126,7 +128,7 @@ where
ReqBody=Body,
ResBody=B,
>,
S::Error: Into<Box<::std::error::Error + Send + Sync>>,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
E: H2Exec<S::Future, B>,
{
if self.closing.is_none() {
@@ -203,7 +205,7 @@ where
impl<F, B> H2Stream<F, B>
where
F: Future<Item=Response<B>>,
F::Error: Into<Box<::std::error::Error + Send + Sync>>,
F::Error: Into<Box<dyn StdError + Send + Sync>>,
B: Payload,
{
fn new(fut: F, respond: SendResponse<SendBuf<B::Data>>) -> H2Stream<F, B> {
@@ -296,7 +298,7 @@ where
impl<F, B> Future for H2Stream<F, B>
where
F: Future<Item=Response<B>>,
F::Error: Into<Box<::std::error::Error + Send + Sync>>,
F::Error: Into<Box<dyn StdError + Send + Sync>>,
B: Payload,
{
type Item = ();