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>
where
B: MessageBody<Error = Error>,
B: MessageBody,
B::Error: Into<Error>,
{
type Error = Error;
@ -66,7 +67,8 @@ where
impl<B> Stream for ResponseBody<B>
where
B: MessageBody<Error = Error>,
B: MessageBody,
B::Error: Into<Error>,
{
type Item = Result<Bytes, Error>;
@ -75,7 +77,7 @@ where
cx: &mut Context<'_>,
) -> Poll<Option<Self::Item>> {
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),
}
}

View File

@ -53,7 +53,7 @@ where
S::Error: Into<Error>,
B: MessageBody,
B: MessageBody<Error = Error>,
B::Error: Into<Error>,
X: Service<Request, Response = Request>,
X::Error: Into<Error>,
@ -75,7 +75,7 @@ where
S::Error: Into<Error>,
B: MessageBody,
B: MessageBody<Error = Error>,
B::Error: Into<Error>,
X: Service<Request, Response = Request>,
X::Error: Into<Error>,
@ -94,7 +94,7 @@ where
S::Error: Into<Error>,
B: MessageBody,
B: MessageBody<Error = Error>,
B::Error: Into<Error>,
X: Service<Request, Response = Request>,
X::Error: Into<Error>,
@ -136,7 +136,7 @@ where
X: Service<Request, Response = Request>,
B: MessageBody,
B: MessageBody<Error = Error>,
B::Error: Into<Error>,
{
None,
ExpectCall(#[pin] X::Future),
@ -151,7 +151,7 @@ where
X: Service<Request, Response = Request>,
B: MessageBody,
B: MessageBody<Error = Error>,
B::Error: Into<Error>,
{
fn is_empty(&self) -> bool {
matches!(self, State::None)
@ -173,7 +173,7 @@ where
S::Response: Into<Response<B>>,
B: MessageBody,
B: MessageBody<Error = Error>,
B::Error: Into<Error>,
X: Service<Request, Response = Request>,
X::Error: Into<Error>,
@ -234,7 +234,7 @@ where
S::Response: Into<Response<B>>,
B: MessageBody,
B: MessageBody<Error = Error>,
B::Error: Into<Error>,
X: Service<Request, Response = Request>,
X::Error: Into<Error>,
@ -850,7 +850,7 @@ where
S::Response: Into<Response<B>>,
B: MessageBody,
B: MessageBody<Error = Error>,
B::Error: Into<Error>,
X: Service<Request, Response = Request>,
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>
where
T: AsyncRead + AsyncWrite + Unpin,
S: Service<Request>,
S::Error: Into<Error> + 'static,
S::Future: 'static,
S::Response: Into<Response<B>> + 'static,
B: MessageBody<Error = Error> + 'static,
B: MessageBody + 'static,
B::Error: Into<Error> + 'static,
{
type Output = Result<(), DispatchError>;
@ -140,7 +143,9 @@ where
F: Future<Output = Result<I, E>>,
E: Into<Error>,
I: Into<Response<B>>,
B: MessageBody,
B::Error: Into<Error>,
{
fn prepare_response(
&self,
@ -216,7 +221,9 @@ where
F: Future<Output = Result<I, E>>,
E: Into<Error>,
I: Into<Response<B>>,
B: MessageBody<Error = Error>,
B: MessageBody,
B::Error: Into<Error>,
{
type Output = ();

View File

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

View File

@ -85,7 +85,8 @@ where
S::InitError: fmt::Debug,
S::Response: Into<Response<B>> + '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)
}
@ -124,7 +125,8 @@ where
S::InitError: fmt::Debug,
S::Response: Into<Response<B>> + '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();