From 4fd58ab791c697702255cbdabaea462cee8e60b3 Mon Sep 17 00:00:00 2001 From: Maxime David Date: Thu, 5 Dec 2024 16:58:00 +0000 Subject: [PATCH] fix: clippy errors --- lambda-events/src/custom_serde/codebuild_time.rs | 2 +- lambda-events/src/custom_serde/float_unix_epoch.rs | 2 +- lambda-events/src/custom_serde/http_method.rs | 2 +- lambda-events/src/encodings/http.rs | 2 +- lambda-events/src/event/cloudwatch_alarms/mod.rs | 2 +- lambda-events/src/event/documentdb/events/insert_event.rs | 1 - lambda-events/src/event/s3/object_lambda.rs | 1 - lambda-extension/src/extension.rs | 6 +++--- lambda-http/src/lib.rs | 2 +- lambda-runtime/src/layers/panic.rs | 6 +++--- lambda-runtime/src/requests.rs | 4 ++-- lambda-runtime/src/runtime.rs | 4 ++-- 12 files changed, 16 insertions(+), 18 deletions(-) diff --git a/lambda-events/src/custom_serde/codebuild_time.rs b/lambda-events/src/custom_serde/codebuild_time.rs index 07bd0a5c..92b0f796 100644 --- a/lambda-events/src/custom_serde/codebuild_time.rs +++ b/lambda-events/src/custom_serde/codebuild_time.rs @@ -10,7 +10,7 @@ use std::fmt; const CODEBUILD_TIME_FORMAT: &str = "%b %e, %Y %l:%M:%S %p"; struct TimeVisitor; -impl<'de> Visitor<'de> for TimeVisitor { +impl Visitor<'_> for TimeVisitor { type Value = DateTime; fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/lambda-events/src/custom_serde/float_unix_epoch.rs b/lambda-events/src/custom_serde/float_unix_epoch.rs index 437e2b1c..805c672f 100644 --- a/lambda-events/src/custom_serde/float_unix_epoch.rs +++ b/lambda-events/src/custom_serde/float_unix_epoch.rs @@ -73,7 +73,7 @@ where d.deserialize_f64(SecondsFloatTimestampVisitor) } -impl<'de> de::Visitor<'de> for SecondsFloatTimestampVisitor { +impl de::Visitor<'_> for SecondsFloatTimestampVisitor { type Value = DateTime; fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/lambda-events/src/custom_serde/http_method.rs b/lambda-events/src/custom_serde/http_method.rs index 42a94dd7..1332c777 100644 --- a/lambda-events/src/custom_serde/http_method.rs +++ b/lambda-events/src/custom_serde/http_method.rs @@ -10,7 +10,7 @@ pub fn serialize(method: &Method, ser: S) -> Result Visitor<'de> for MethodVisitor { +impl Visitor<'_> for MethodVisitor { type Value = Method; fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/lambda-events/src/encodings/http.rs b/lambda-events/src/encodings/http.rs index 56cce76a..d978f522 100644 --- a/lambda-events/src/encodings/http.rs +++ b/lambda-events/src/encodings/http.rs @@ -197,7 +197,7 @@ impl<'de> Deserialize<'de> for Body { { struct BodyVisitor; - impl<'de> Visitor<'de> for BodyVisitor { + impl Visitor<'_> for BodyVisitor { type Value = Body; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { diff --git a/lambda-events/src/event/cloudwatch_alarms/mod.rs b/lambda-events/src/event/cloudwatch_alarms/mod.rs index 01174566..d99f3c94 100644 --- a/lambda-events/src/event/cloudwatch_alarms/mod.rs +++ b/lambda-events/src/event/cloudwatch_alarms/mod.rs @@ -232,7 +232,7 @@ impl Serialize for CloudWatchAlarmStateReasonData { struct ReasonDataVisitor; -impl<'de> Visitor<'de> for ReasonDataVisitor { +impl Visitor<'_> for ReasonDataVisitor { type Value = CloudWatchAlarmStateReasonData; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { diff --git a/lambda-events/src/event/documentdb/events/insert_event.rs b/lambda-events/src/event/documentdb/events/insert_event.rs index de9b5843..2f4df397 100644 --- a/lambda-events/src/event/documentdb/events/insert_event.rs +++ b/lambda-events/src/event/documentdb/events/insert_event.rs @@ -4,7 +4,6 @@ use super::commom_types::{AnyDocument, DatabaseCollection, DocumentId, DocumentK #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] - pub struct ChangeInsertEvent { #[serde(rename = "_id")] id: DocumentId, diff --git a/lambda-events/src/event/s3/object_lambda.rs b/lambda-events/src/event/s3/object_lambda.rs index 2abcc797..738cd72c 100644 --- a/lambda-events/src/event/s3/object_lambda.rs +++ b/lambda-events/src/event/s3/object_lambda.rs @@ -87,7 +87,6 @@ pub struct UserRequest { /// `UserIdentity` contains details about the identity that made the call to S3 Object Lambda #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] - pub struct UserIdentity { pub r#type: String, pub principal_id: String, diff --git a/lambda-extension/src/extension.rs b/lambda-extension/src/extension.rs index d9717243..15e0befd 100644 --- a/lambda-extension/src/extension.rs +++ b/lambda-extension/src/extension.rs @@ -43,7 +43,7 @@ pub struct Extension<'a, E, L, T> { telemetry_port_number: u16, } -impl<'a> Extension<'a, Identity, MakeIdentity>, MakeIdentity>> { +impl Extension<'_, Identity, MakeIdentity>, MakeIdentity>> { /// Create a new base [`Extension`] with a no-op events processor pub fn new() -> Self { Extension { @@ -62,8 +62,8 @@ impl<'a> Extension<'a, Identity, MakeIdentity>, Make } } -impl<'a> Default - for Extension<'a, Identity, MakeIdentity>, MakeIdentity>> +impl Default + for Extension<'_, Identity, MakeIdentity>, MakeIdentity>> { fn default() -> Self { Self::new() diff --git a/lambda-http/src/lib.rs b/lambda-http/src/lib.rs index 233d6992..92cd5dae 100644 --- a/lambda-http/src/lib.rs +++ b/lambda-http/src/lib.rs @@ -114,7 +114,7 @@ pub enum TransformResponse<'a, R, E> { Response(RequestOrigin, ResponseFuture), } -impl<'a, R, E> Future for TransformResponse<'a, R, E> +impl Future for TransformResponse<'_, R, E> where R: IntoResponse, { diff --git a/lambda-runtime/src/layers/panic.rs b/lambda-runtime/src/layers/panic.rs index c76348ac..4b92e3c8 100644 --- a/lambda-runtime/src/layers/panic.rs +++ b/lambda-runtime/src/layers/panic.rs @@ -18,7 +18,7 @@ pub struct CatchPanicService<'a, S> { _phantom: PhantomData<&'a ()>, } -impl<'a, S> CatchPanicService<'a, S> { +impl CatchPanicService<'_, S> { pub fn new(inner: S) -> Self { Self { inner, @@ -66,7 +66,7 @@ pub enum CatchPanicFuture<'a, F> { Error(Box), } -impl<'a, F, T, E> Future for CatchPanicFuture<'a, F> +impl Future for CatchPanicFuture<'_, F> where F: Future>, E: Into + Debug, @@ -95,7 +95,7 @@ where } } -impl<'a, F> CatchPanicFuture<'a, F> { +impl CatchPanicFuture<'_, F> { fn build_panic_diagnostic(err: &Box) -> Diagnostic { let error_message = if let Some(msg) = err.downcast_ref::<&str>() { format!("Lambda panicked: {msg}") diff --git a/lambda-runtime/src/requests.rs b/lambda-runtime/src/requests.rs index 729272f2..e8b0183c 100644 --- a/lambda-runtime/src/requests.rs +++ b/lambda-runtime/src/requests.rs @@ -72,7 +72,7 @@ where } } -impl<'a, R, B, S, D, E> IntoRequest for EventCompletionRequest<'a, R, B, S, D, E> +impl IntoRequest for EventCompletionRequest<'_, R, B, S, D, E> where R: IntoFunctionResponse, B: Serialize, @@ -170,7 +170,7 @@ impl<'a> EventErrorRequest<'a> { } } -impl<'a> IntoRequest for EventErrorRequest<'a> { +impl IntoRequest for EventErrorRequest<'_> { fn into_req(self) -> Result, Error> { let uri = format!("/2018-06-01/runtime/invocation/{}/error", self.request_id); let uri = Uri::from_str(&uri)?; diff --git a/lambda-runtime/src/runtime.rs b/lambda-runtime/src/runtime.rs index 1c676480..5749fbb7 100644 --- a/lambda-runtime/src/runtime.rs +++ b/lambda-runtime/src/runtime.rs @@ -55,11 +55,11 @@ pub struct Runtime { client: Arc, } -impl<'a, F, EventPayload, Response, BufferedResponse, StreamingResponse, StreamItem, StreamError> +impl Runtime< RuntimeApiClientService< RuntimeApiResponseService< - CatchPanicService<'a, F>, + CatchPanicService<'_, F>, EventPayload, Response, BufferedResponse,