diff --git a/tower-async-http/_todo_examples/axum-key-value-store/main.rs b/tower-async-http/_todo_examples/axum-key-value-store/main.rs index c9bd9a1..2b72b17 100644 --- a/tower-async-http/_todo_examples/axum-key-value-store/main.rs +++ b/tower-async-http/_todo_examples/axum-key-value-store/main.rs @@ -79,11 +79,11 @@ fn app() -> Router { .map_response_body(axum::body::boxed) // Compress responses .compression(); - // Set a `Content-Type` if there isn't one already. - // .insert_response_header_if_not_present( - // header::CONTENT_TYPE, - // HeaderValue::from_static("application/octet-stream"), - // ); + // Set a `Content-Type` if there isn't one already. + // .insert_response_header_if_not_present( + // header::CONTENT_TYPE, + // HeaderValue::from_static("application/octet-stream"), + // ); let router_layer = middleware.into_classic(); diff --git a/tower-async-http/src/classify/grpc_errors_as_failures.rs b/tower-async-http/src/classify/grpc_errors_as_failures.rs index ffc299c..3d2f8c3 100644 --- a/tower-async-http/src/classify/grpc_errors_as_failures.rs +++ b/tower-async-http/src/classify/grpc_errors_as_failures.rs @@ -207,7 +207,7 @@ impl ClassifyResponse for GrpcErrorsAsFailures { fn classify_error(self, error: &E) -> Self::FailureClass where - E: fmt::Display + 'static, + E: fmt::Display, { GrpcFailureClass::Error(error.to_string()) } @@ -238,7 +238,7 @@ impl ClassifyEos for GrpcEosErrorsAsFailures { fn classify_error(self, error: &E) -> Self::FailureClass where - E: fmt::Display + 'static, + E: fmt::Display, { GrpcFailureClass::Error(error.to_string()) } diff --git a/tower-async-http/src/classify/map_failure_class.rs b/tower-async-http/src/classify/map_failure_class.rs index 680593b..254268d 100644 --- a/tower-async-http/src/classify/map_failure_class.rs +++ b/tower-async-http/src/classify/map_failure_class.rs @@ -54,7 +54,7 @@ where fn classify_error(self, error: &E) -> Self::FailureClass where - E: std::fmt::Display + 'static, + E: std::fmt::Display, { (self.f)(self.inner.classify_error(error)) } @@ -73,7 +73,7 @@ where fn classify_error(self, error: &E) -> Self::FailureClass where - E: std::fmt::Display + 'static, + E: std::fmt::Display, { (self.f)(self.inner.classify_error(error)) } diff --git a/tower-async-http/src/classify/mod.rs b/tower-async-http/src/classify/mod.rs index 80808d2..eec5ebc 100644 --- a/tower-async-http/src/classify/mod.rs +++ b/tower-async-http/src/classify/mod.rs @@ -78,7 +78,7 @@ pub trait MakeClassifier { /// /// fn classify_error(self, error: &E) -> Self::FailureClass /// where -/// E: fmt::Display + 'static, +/// E: fmt::Display, /// { /// error.to_string() /// } @@ -180,7 +180,7 @@ pub trait ClassifyResponse { /// errors. A retry policy might allow retrying some errors and not others. fn classify_error(self, error: &E) -> Self::FailureClass where - E: fmt::Display + 'static; + E: fmt::Display; /// Transform the failure classification using a function. /// @@ -251,7 +251,7 @@ pub trait ClassifyEos { /// errors. A retry policy might allow retrying some errors and not others. fn classify_error(self, error: &E) -> Self::FailureClass where - E: fmt::Display + 'static; + E: fmt::Display; /// Transform the failure classification using a function. /// @@ -293,7 +293,7 @@ impl ClassifyEos for NeverClassifyEos { fn classify_error(self, _error: &E) -> Self::FailureClass where - E: fmt::Display + 'static, + E: fmt::Display, { // `NeverClassifyEos` contains an `Infallible` so it can never be constructed unreachable!() @@ -346,7 +346,7 @@ impl ClassifyResponse for ServerErrorsAsFailures { fn classify_error(self, error: &E) -> Self::FailureClass where - E: fmt::Display + 'static, + E: fmt::Display, { ServerErrorsFailureClass::Error(error.to_string()) } @@ -391,11 +391,11 @@ mod usable_for_retries { impl Policy, Response, E> for RetryBasedOnClassification where C: ClassifyResponse + Clone, - E: fmt::Display + 'static, + E: fmt::Display, C::FailureClass: IsRetryable, ResB: http_body::Body, Request: Clone, - E: std::error::Error + 'static, + E: std::error::Error, { async fn retry( &self, diff --git a/tower-async-http/src/classify/status_in_range_is_error.rs b/tower-async-http/src/classify/status_in_range_is_error.rs index 4338101..069a11e 100644 --- a/tower-async-http/src/classify/status_in_range_is_error.rs +++ b/tower-async-http/src/classify/status_in_range_is_error.rs @@ -96,7 +96,7 @@ impl ClassifyResponse for StatusInRangeAsFailures { fn classify_error(self, error: &E) -> Self::FailureClass where - E: std::fmt::Display + 'static, + E: std::fmt::Display, { StatusInRangeFailureClass::Error(error.to_string()) } diff --git a/tower-async-http/src/trace/body.rs b/tower-async-http/src/trace/body.rs index 8a862e7..a7acdc8 100644 --- a/tower-async-http/src/trace/body.rs +++ b/tower-async-http/src/trace/body.rs @@ -31,7 +31,7 @@ impl Body for ResponseBody where B: Body, - B::Error: fmt::Display + 'static, + B::Error: fmt::Display, C: ClassifyEos, OnEosT: OnEos, OnBodyChunkT: OnBodyChunk, diff --git a/tower-async-http/src/trace/mod.rs b/tower-async-http/src/trace/mod.rs index dba03cf..d86748d 100644 --- a/tower-async-http/src/trace/mod.rs +++ b/tower-async-http/src/trace/mod.rs @@ -342,7 +342,7 @@ //! //! fn classify_error(self, error: &E) -> Self::FailureClass //! where -//! E: std::fmt::Display + 'static, +//! E: std::fmt::Display, //! { //! "something went wrong..." //! } diff --git a/tower-async-http/src/trace/on_eos.rs b/tower-async-http/src/trace/on_eos.rs index ab90fc9..1ad0e8d 100644 --- a/tower-async-http/src/trace/on_eos.rs +++ b/tower-async-http/src/trace/on_eos.rs @@ -32,7 +32,7 @@ impl OnEos for () { impl OnEos for F where - F: FnOnce(Option<&HeaderMap>, Duration, &Span), + F: Fn(Option<&HeaderMap>, Duration, &Span), { fn on_eos(self, trailers: Option<&HeaderMap>, stream_duration: Duration, span: &Span) { self(trailers, stream_duration, span) diff --git a/tower-async-http/src/trace/on_response.rs b/tower-async-http/src/trace/on_response.rs index c6ece84..f82748f 100644 --- a/tower-async-http/src/trace/on_response.rs +++ b/tower-async-http/src/trace/on_response.rs @@ -33,7 +33,7 @@ impl OnResponse for () { impl OnResponse for F where - F: FnOnce(&Response, Duration, &Span), + F: Fn(&Response, Duration, &Span), { fn on_response(self, response: &Response, latency: Duration, span: &Span) { self(response, latency, span) diff --git a/tower-async-http/src/trace/service.rs b/tower-async-http/src/trace/service.rs index 5e25195..7ab3ee6 100644 --- a/tower-async-http/src/trace/service.rs +++ b/tower-async-http/src/trace/service.rs @@ -274,8 +274,8 @@ where S: Service, Response = Response>, ReqBody: Body, ResBody: Body, - ResBody::Error: fmt::Display + 'static, - S::Error: fmt::Display + 'static, + ResBody::Error: fmt::Display, + S::Error: fmt::Display, M: MakeClassifier, M::Classifier: Clone, MakeSpanT: MakeSpan, diff --git a/tower-async-service/src/lib.rs b/tower-async-service/src/lib.rs index 64f5d2d..73715a3 100644 --- a/tower-async-service/src/lib.rs +++ b/tower-async-service/src/lib.rs @@ -137,7 +137,7 @@ /// impl Service for Timeout /// where /// T: Service, -/// T::Error: Into> + 'static, +/// T::Error: Into>, /// T::Response: 'static, /// { /// // `Timeout` doesn't modify the response type, so we use `T`'s response type