migrate some bounds to into<error>

This commit is contained in:
Rob Ede 2021-04-22 14:33:18 +01:00
parent ea379d532a
commit 70f5f2ae40
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
5 changed files with 36 additions and 25 deletions

View File

@ -45,7 +45,8 @@ impl<B: MessageBody> ResponseBody<B> {
impl<B> MessageBody for ResponseBody<B> impl<B> MessageBody for ResponseBody<B>
where where
B: MessageBody<Error = Error>, B: MessageBody,
B::Error: Into<Error>,
{ {
type Error = Error; type Error = Error;
@ -66,7 +67,8 @@ where
impl<B> Stream for ResponseBody<B> impl<B> Stream for ResponseBody<B>
where where
B: MessageBody<Error = Error>, B: MessageBody,
B::Error: Into<Error>,
{ {
type Item = Result<Bytes, Error>; type Item = Result<Bytes, Error>;
@ -75,7 +77,7 @@ where
cx: &mut Context<'_>, cx: &mut Context<'_>,
) -> Poll<Option<Self::Item>> { ) -> Poll<Option<Self::Item>> {
match self.project() { match self.project() {
ResponseBodyProj::Body(body) => body.poll_next(cx), ResponseBodyProj::Body(body) => body.poll_next(cx).map_err(Into::into),
ResponseBodyProj::Other(body) => Pin::new(body).poll_next(cx), ResponseBodyProj::Other(body) => Pin::new(body).poll_next(cx),
} }
} }

View File

@ -53,7 +53,7 @@ where
S::Error: Into<Error>, S::Error: Into<Error>,
B: MessageBody, B: MessageBody,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: Service<Request, Response = Request>, X: Service<Request, Response = Request>,
X::Error: Into<Error>, X::Error: Into<Error>,
@ -75,7 +75,7 @@ where
S::Error: Into<Error>, S::Error: Into<Error>,
B: MessageBody, B: MessageBody,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: Service<Request, Response = Request>, X: Service<Request, Response = Request>,
X::Error: Into<Error>, X::Error: Into<Error>,
@ -94,7 +94,7 @@ where
S::Error: Into<Error>, S::Error: Into<Error>,
B: MessageBody, B: MessageBody,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: Service<Request, Response = Request>, X: Service<Request, Response = Request>,
X::Error: Into<Error>, X::Error: Into<Error>,
@ -136,7 +136,7 @@ where
X: Service<Request, Response = Request>, X: Service<Request, Response = Request>,
B: MessageBody, B: MessageBody,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
{ {
None, None,
ExpectCall(#[pin] X::Future), ExpectCall(#[pin] X::Future),
@ -151,7 +151,7 @@ where
X: Service<Request, Response = Request>, X: Service<Request, Response = Request>,
B: MessageBody, B: MessageBody,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
{ {
fn is_empty(&self) -> bool { fn is_empty(&self) -> bool {
matches!(self, State::None) matches!(self, State::None)
@ -173,7 +173,7 @@ where
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody, B: MessageBody,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: Service<Request, Response = Request>, X: Service<Request, Response = Request>,
X::Error: Into<Error>, X::Error: Into<Error>,
@ -234,7 +234,7 @@ where
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody, B: MessageBody,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: Service<Request, Response = Request>, X: Service<Request, Response = Request>,
X::Error: Into<Error>, X::Error: Into<Error>,
@ -850,7 +850,7 @@ where
S::Response: Into<Response<B>>, S::Response: Into<Response<B>>,
B: MessageBody, B: MessageBody,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: Service<Request, Response = Request>, X: Service<Request, Response = Request>,
X::Error: Into<Error>, X::Error: Into<Error>,

View File

@ -69,11 +69,14 @@ where
impl<T, S, B, X, U> Future for Dispatcher<T, S, B, X, U> impl<T, S, B, X, U> Future for Dispatcher<T, S, B, X, U>
where where
T: AsyncRead + AsyncWrite + Unpin, T: AsyncRead + AsyncWrite + Unpin,
S: Service<Request>, S: Service<Request>,
S::Error: Into<Error> + 'static, S::Error: Into<Error> + 'static,
S::Future: 'static, S::Future: 'static,
S::Response: Into<Response<B>> + 'static, S::Response: Into<Response<B>> + 'static,
B: MessageBody<Error = Error> + 'static,
B: MessageBody + 'static,
B::Error: Into<Error> + 'static,
{ {
type Output = Result<(), DispatchError>; type Output = Result<(), DispatchError>;
@ -140,7 +143,9 @@ where
F: Future<Output = Result<I, E>>, F: Future<Output = Result<I, E>>,
E: Into<Error>, E: Into<Error>,
I: Into<Response<B>>, I: Into<Response<B>>,
B: MessageBody, B: MessageBody,
B::Error: Into<Error>,
{ {
fn prepare_response( fn prepare_response(
&self, &self,
@ -216,7 +221,9 @@ where
F: Future<Output = Result<I, E>>, F: Future<Output = Result<I, E>>,
E: Into<Error>, E: Into<Error>,
I: Into<Response<B>>, I: Into<Response<B>>,
B: MessageBody<Error = Error>,
B: MessageBody,
B::Error: Into<Error>,
{ {
type Output = (); type Output = ();

View File

@ -157,7 +157,7 @@ where
<S::Service as Service<Request>>::Future: 'static, <S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static, B: MessageBody + 'static,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: ServiceFactory<Request, Config = (), Response = Request>, X: ServiceFactory<Request, Config = (), Response = Request>,
X::Future: 'static, X::Future: 'static,
@ -209,7 +209,7 @@ mod openssl {
<S::Service as Service<Request>>::Future: 'static, <S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static, B: MessageBody + 'static,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: ServiceFactory<Request, Config = (), Response = Request>, X: ServiceFactory<Request, Config = (), Response = Request>,
X::Future: 'static, X::Future: 'static,
@ -277,7 +277,7 @@ mod rustls {
<S::Service as Service<Request>>::Future: 'static, <S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static, B: MessageBody + 'static,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: ServiceFactory<Request, Config = (), Response = Request>, X: ServiceFactory<Request, Config = (), Response = Request>,
X::Future: 'static, X::Future: 'static,
@ -342,7 +342,7 @@ where
<S::Service as Service<Request>>::Future: 'static, <S::Service as Service<Request>>::Future: 'static,
B: MessageBody + 'static, B: MessageBody + 'static,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: ServiceFactory<Request, Config = (), Response = Request>, X: ServiceFactory<Request, Config = (), Response = Request>,
X::Future: 'static, X::Future: 'static,
@ -476,7 +476,7 @@ where
S::Response: Into<Response<B>> + 'static, S::Response: Into<Response<B>> + 'static,
B: MessageBody + 'static, B: MessageBody + 'static,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: Service<Request, Response = Request>, X: Service<Request, Response = Request>,
X::Error: Into<Error>, X::Error: Into<Error>,
@ -538,7 +538,7 @@ where
S::Error: Into<Error>, S::Error: Into<Error>,
B: MessageBody, B: MessageBody,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: Service<Request, Response = Request>, X: Service<Request, Response = Request>,
X::Error: Into<Error>, X::Error: Into<Error>,
@ -569,8 +569,8 @@ where
S::Future: 'static, S::Future: 'static,
S::Response: Into<Response<B>> + 'static, S::Response: Into<Response<B>> + 'static,
B: MessageBody + 'static, B: MessageBody,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: Service<Request, Response = Request>, X: Service<Request, Response = Request>,
X::Error: Into<Error>, X::Error: Into<Error>,
@ -591,8 +591,8 @@ where
S::Future: 'static, S::Future: 'static,
S::Response: Into<Response<B>> + 'static, S::Response: Into<Response<B>> + 'static,
B: MessageBody, B: MessageBody + 'static,
B: MessageBody<Error = Error>, B::Error: Into<Error>,
X: Service<Request, Response = Request>, X: Service<Request, Response = Request>,
X::Error: Into<Error>, X::Error: Into<Error>,

View File

@ -85,7 +85,8 @@ where
S::InitError: fmt::Debug, S::InitError: fmt::Debug,
S::Response: Into<Response<B>> + 'static, S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static, <S::Service as Service<Request>>::Future: 'static,
B: MessageBody<Error = Error> + 'static, B: MessageBody + 'static,
B::Error: Into<Error>,
{ {
start_with(TestServerConfig::default(), factory) start_with(TestServerConfig::default(), factory)
} }
@ -124,7 +125,8 @@ where
S::InitError: fmt::Debug, S::InitError: fmt::Debug,
S::Response: Into<Response<B>> + 'static, S::Response: Into<Response<B>> + 'static,
<S::Service as Service<Request>>::Future: 'static, <S::Service as Service<Request>>::Future: 'static,
B: MessageBody<Error = Error> + 'static, B: MessageBody + 'static,
B::Error: Into<Error>,
{ {
let (tx, rx) = mpsc::channel(); let (tx, rx) = mpsc::channel();