From 2adb34c8aa76aeaa7c5aa536c94734db574bc621 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Tue, 19 Apr 2022 16:47:27 +0200 Subject: [PATCH] Revert "Allow `Error: Into` for `Route::{layer, route_layer}` (#924)" (#946) This reverts commit ca7ecb159bb1bc77c2c3623358ea028b0722e686. --- axum/CHANGELOG.md | 2 -- axum/src/routing/mod.rs | 15 ++++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md index 69dbe8ae..d498dfd4 100644 --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -14,11 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **added:** Add `AppendHeaders` for appending headers to a response rather than overriding them ([#927]) - **added:** Add `axum::extract::multipart::Field::chunk` method for streaming a single chunk from the field ([#901]) -- **changed:** Allow `Error: Into` for `Route::{layer, route_layer}` ([#924]) - **fixed:** Fix trailing slash redirection with query parameters ([#936]) [#901]: https://github.com/tokio-rs/axum/pull/901 -[#924]: https://github.com/tokio-rs/axum/pull/924 [#927]: https://github.com/tokio-rs/axum/pull/927 [#936]: https://github.com/tokio-rs/axum/pull/936 diff --git a/axum/src/routing/mod.rs b/axum/src/routing/mod.rs index df4352f3..581e9241 100644 --- a/axum/src/routing/mod.rs +++ b/axum/src/routing/mod.rs @@ -291,15 +291,15 @@ where pub fn layer(self, layer: L) -> Router where L: Layer>, - L::Service: - Service, Response = Response> + Clone + Send + 'static, - >>::Error: Into + 'static, + L::Service: Service, Response = Response, Error = Infallible> + + Clone + + Send + + 'static, >>::Future: Send + 'static, NewResBody: HttpBody + Send + 'static, NewResBody::Error: Into, { let layer = ServiceBuilder::new() - .map_err(Into::into) .layer(MapResponseBodyLayer::new(boxed)) .layer(layer) .into_inner(); @@ -332,14 +332,15 @@ where pub fn route_layer(self, layer: L) -> Self where L: Layer>, - L::Service: Service, Response = Response> + Clone + Send + 'static, - >>::Error: Into + 'static, + L::Service: Service, Response = Response, Error = Infallible> + + Clone + + Send + + 'static, >>::Future: Send + 'static, NewResBody: HttpBody + Send + 'static, NewResBody::Error: Into, { let layer = ServiceBuilder::new() - .map_err(Into::into) .layer(MapResponseBodyLayer::new(boxed)) .layer(layer) .into_inner();