diff --git a/core/lib/src/fairing/ad_hoc.rs b/core/lib/src/fairing/ad_hoc.rs index b1ae3472..c3520856 100644 --- a/core/lib/src/fairing/ad_hoc.rs +++ b/core/lib/src/fairing/ad_hoc.rs @@ -53,7 +53,7 @@ enum AdHocKind { Request(Box Fn(&'a mut Request<'_>, &'a Data) -> BoxFuture<'a, ()> + Send + Sync + 'static>), /// An ad-hoc **response** fairing. Called when a response is ready to be /// sent to a client. - Response(Box Fn(&'a Request<'r>, &'a mut Response<'r>) -> BoxFuture<'a, ()> + Send + Sync + 'static>), + Response(Box Fn(&'a Request<'_>, &'a mut Response<'_>) -> BoxFuture<'a, ()> + Send + Sync + 'static>), } impl AdHoc { @@ -132,7 +132,7 @@ impl AdHoc { /// }); /// ``` pub fn on_response(name: &'static str, f: F) -> AdHoc - where F: for<'a, 'r> Fn(&'a Request<'r>, &'a mut Response<'r>) -> BoxFuture<'a, ()> + Send + Sync + 'static + where F: for<'a> Fn(&'a Request<'_>, &'a mut Response<'_>) -> BoxFuture<'a, ()> + Send + Sync + 'static { AdHoc { name, kind: AdHocKind::Response(Box::new(f)) } } @@ -176,7 +176,7 @@ impl Fairing for AdHoc { } } - fn on_response<'a, 'r>(&'a self, request: &'a Request<'r>, response: &'a mut Response<'r>) -> BoxFuture<'a, ()> { + fn on_response<'a>(&'a self, request: &'a Request<'_>, response: &'a mut Response<'_>) -> BoxFuture<'a, ()> { if let AdHocKind::Response(ref callback) = self.kind { callback(request, response) } else { diff --git a/core/lib/src/fairing/mod.rs b/core/lib/src/fairing/mod.rs index 2b3e2510..84e961bf 100644 --- a/core/lib/src/fairing/mod.rs +++ b/core/lib/src/fairing/mod.rs @@ -238,7 +238,7 @@ pub use self::info_kind::{Info, Kind}; /// }) /// } /// -/// fn on_response<'a, 'r>(&'a self, request: &'a Request<'r>, response: &'a mut Response<'r>) -> Pin + Send + 'a>> { +/// fn on_response<'a>(&'a self, request: &'a Request<'_>, response: &'a mut Response<'_>) -> Pin + Send + 'a>> { /// Box::pin(async move { /// // Don't change a successful user's response, ever. /// if response.status() != Status::NotFound { @@ -306,7 +306,7 @@ pub use self::info_kind::{Info, Kind}; /// /// /// Adds a header to the response indicating how long the server took to /// /// process the request. -/// fn on_response<'a, 'r>(&'a self, request: &'a Request<'r>, response: &'a mut Response<'r>) -> Pin + Send + 'a>> { +/// fn on_response<'a>(&'a self, request: &'a Request<'_>, response: &'a mut Response<'_>) -> Pin + Send + 'a>> { /// Box::pin(async move { /// let start_time = request.local_cache(|| TimerStart(None)); /// if let Some(Ok(duration)) = start_time.0.map(|st| st.elapsed()) { @@ -424,7 +424,7 @@ pub trait Fairing: Send + Sync + 'static { /// /// The default implementation of this method does nothing. #[allow(unused_variables)] - fn on_response<'a, 'r>(&'a self, request: &'a Request<'r>, response: &'a mut Response<'r>) -> BoxFuture<'a, ()> { + fn on_response<'a>(&'a self, request: &'a Request<'_>, response: &'a mut Response<'_>) -> BoxFuture<'a, ()> { Box::pin(async { }) } } @@ -451,7 +451,7 @@ impl Fairing for std::sync::Arc { } #[inline] - fn on_response<'a, 'r>(&'a self, request: &'a Request<'r>, response: &'a mut Response<'r>) -> BoxFuture<'a, ()> { + fn on_response<'a>(&'a self, request: &'a Request<'_>, response: &'a mut Response<'_>) -> BoxFuture<'a, ()> { (self as &T).on_response(request, response) } } diff --git a/examples/fairings/src/main.rs b/examples/fairings/src/main.rs index a4cc0513..f79aeec6 100644 --- a/examples/fairings/src/main.rs +++ b/examples/fairings/src/main.rs @@ -39,7 +39,7 @@ impl Fairing for Counter { }) } - fn on_response<'a, 'r>(&'a self, request: &'a Request<'r>, response: &'a mut Response<'r>) + fn on_response<'a>(&'a self, request: &'a Request<'_>, response: &'a mut Response<'_>) -> std::pin::Pin + Send + 'a>> { Box::pin(async move {