From fab9f5eee5d2777c1ef6f9dd912b10e82040072d Mon Sep 17 00:00:00 2001 From: Gaurav Rawat <104276743+GauravRawat369@users.noreply.github.com> Date: Tue, 27 May 2025 15:31:22 +0530 Subject: [PATCH] chore: address Rust 1.87.0 clippy lints (#8130) --- crates/external_services/src/email/ses.rs | 4 ++-- crates/kgraph_utils/src/error.rs | 2 +- crates/kgraph_utils/src/transformers.rs | 4 ++-- crates/masking/src/serde.rs | 1 - crates/router/src/bin/router.rs | 2 +- crates/router/src/core/payments/helpers.rs | 8 +++++--- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/crates/external_services/src/email/ses.rs b/crates/external_services/src/email/ses.rs index f8e941b57b..bc813b7d64 100644 --- a/crates/external_services/src/email/ses.rs +++ b/crates/external_services/src/email/ses.rs @@ -54,7 +54,7 @@ impl SESConfig { pub enum AwsSesError { /// An error occurred in the SDK while sending email. #[error("Failed to Send Email {0:?}")] - SendingFailure(aws_sdk_sesv2::error::SdkError), + SendingFailure(Box>), /// Configuration variable is missing to construct the email client #[error("Missing configuration variable {0}")] @@ -245,7 +245,7 @@ impl EmailClient for AwsSes { ) .send() .await - .map_err(AwsSesError::SendingFailure) + .map_err(|e| AwsSesError::SendingFailure(Box::new(e))) .change_context(EmailError::EmailSendingFailure)?; Ok(()) diff --git a/crates/kgraph_utils/src/error.rs b/crates/kgraph_utils/src/error.rs index 017b53ec0c..2363e08c49 100644 --- a/crates/kgraph_utils/src/error.rs +++ b/crates/kgraph_utils/src/error.rs @@ -14,7 +14,7 @@ pub enum KgraphError { #[error("There was an error constructing the graph: {0}")] GraphConstructionError(hyperswitch_constraint_graph::GraphError), #[error("There was an error constructing the context")] - ContextConstructionError(AnalysisErrorType), + ContextConstructionError(Box), #[error("there was an unprecedented indexing error")] IndexingError, } diff --git a/crates/kgraph_utils/src/transformers.rs b/crates/kgraph_utils/src/transformers.rs index ecfb179a83..f2de988c0f 100644 --- a/crates/kgraph_utils/src/transformers.rs +++ b/crates/kgraph_utils/src/transformers.rs @@ -168,7 +168,7 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) { | api_enums::PaymentMethod::Voucher | api_enums::PaymentMethod::OpenBanking | api_enums::PaymentMethod::GiftCard => Err(KgraphError::ContextConstructionError( - AnalysisErrorType::NotSupported, + Box::new(AnalysisErrorType::NotSupported), )), }, api_enums::PaymentMethodType::Bacs => match self.1 { @@ -187,7 +187,7 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) { | api_enums::PaymentMethod::Voucher | api_enums::PaymentMethod::OpenBanking | api_enums::PaymentMethod::GiftCard => Err(KgraphError::ContextConstructionError( - AnalysisErrorType::NotSupported, + Box::new(AnalysisErrorType::NotSupported), )), }, api_enums::PaymentMethodType::Becs => Ok(dirval!(BankDebitType = Becs)), diff --git a/crates/masking/src/serde.rs b/crates/masking/src/serde.rs index 48514df8c6..ecb92086a6 100644 --- a/crates/masking/src/serde.rs +++ b/crates/masking/src/serde.rs @@ -15,7 +15,6 @@ use crate::{Secret, Strategy, StrongSecret, ZeroizableSecret}; /// /// This is done deliberately to prevent accidental exfiltration of secrets /// via `serde` serialization. - #[cfg_attr(docsrs, cfg(feature = "serde"))] pub trait SerializableSecret: Serialize {} // #[cfg_attr(docsrs, doc(cfg(feature = "serde")))] diff --git a/crates/router/src/bin/router.rs b/crates/router/src/bin/router.rs index 212a125742..0fb415bdd4 100644 --- a/crates/router/src/bin/router.rs +++ b/crates/router/src/bin/router.rs @@ -45,6 +45,6 @@ async fn main() -> ApplicationResult<()> { let _ = server.await; Err(error_stack::Report::from(ApplicationError::from( - std::io::Error::new(std::io::ErrorKind::Other, "Server shut down"), + std::io::Error::other("Server shut down"), ))) } diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index c3c6352152..220a48cd1e 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -2008,9 +2008,11 @@ pub fn decide_payment_method_retrieval_action( ) }; - should_retry_with_pan - .then_some(VaultFetchAction::FetchCardDetailsFromLocker) - .unwrap_or_else(standard_flow) + if should_retry_with_pan { + VaultFetchAction::FetchCardDetailsFromLocker + } else { + standard_flow() + } } pub fn determine_standard_vault_action(