Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

chore: address Rust 1.90.0 clippy lints (#9511)

Gaurav Rawat198fe07891a1
diff --git a/crates/analytics/src/sqlx.rs b/crates/analytics/src/sqlx.rs
index 926c28684e..c7b704d0e8 100644
--- a/crates/analytics/src/sqlx.rs
+++ b/crates/analytics/src/sqlx.rs
@@ -112,7 +112,7 @@ where
fn encode_by_ref(
&self,
buf: &mut PgArgumentBuffer,
- ) -> Result<sqlx::encode::IsNull, Box<(dyn std::error::Error + Send + Sync + 'static)>> {
+ ) -> Result<sqlx::encode::IsNull, Box<dyn std::error::Error + Send + Sync + 'static>> {
<String as Encode<'q, Postgres>>::encode(self.0.to_string(), buf)
}
fn size_hint(&self) -> usize {
diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
index ebc244832b..02ea56b6d3 100644
--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
@@ -115,12 +115,6 @@ struct CreditCardDetails {
card_code: Option<Secret<String>>,
}
-#[derive(Serialize, Deserialize, Debug)]
-#[serde(rename_all = "camelCase")]
-struct BankAccountDetails {
- account_number: Secret<String>,
-}
-
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
enum PaymentDetails {
diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay/requests.rs b/crates/hyperswitch_connectors/src/connectors/globalpay/requests.rs
index 056e546db2..dcda455e2b 100644
--- a/crates/hyperswitch_connectors/src/connectors/globalpay/requests.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globalpay/requests.rs
@@ -287,13 +287,6 @@ pub enum UsageMode {
UseNetworkToken,
}
-#[derive(Default, Debug, Serialize, Deserialize)]
-pub struct GlobalPayPayer {
- /// Unique identifier for the Payer on the Global Payments system.
- #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
- pub payer_id: Option<String>,
-}
-
#[derive(Default, Debug, Serialize)]
pub struct GlobalPayPaymentMethodsRequest {
pub reference: String,
diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay/response.rs b/crates/hyperswitch_connectors/src/connectors/globalpay/response.rs
index daa629641e..89f5da8ba1 100644
--- a/crates/hyperswitch_connectors/src/connectors/globalpay/response.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globalpay/response.rs
@@ -49,19 +49,6 @@ pub struct Card {
pub brand_reference: Option<Secret<String>>,
}
-/// A string used to identify the payment method provider being used to execute this
-/// transaction.
-#[derive(Debug, Serialize, Deserialize)]
-#[serde(rename_all = "snake_case")]
-pub enum ApmProvider {
- Giropay,
- Ideal,
- Paypal,
- Sofort,
- Eps,
- Testpay,
-}
-
/// Indicates where a transaction is in its lifecycle.
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
@@ -112,18 +99,6 @@ pub enum GlobalpayWebhookStatus {
Unknown,
}
-#[derive(Debug, Serialize, Deserialize)]
-#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
-pub enum GlobalpayPaymentMethodStatus {
- /// The entity is ACTIVE and can be used.
- Active,
- /// The entity is INACTIVE and cannot be used.
- Inactive,
- /// The status is DELETED. Once returned in an action response for a resource.
- /// The resource has been removed from the platform.
- Delete,
-}
-
#[derive(Debug, Serialize, Deserialize)]
pub struct GlobalpayPaymentMethodsResponse {
#[serde(rename = "id")]
diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
index b4cd758ef6..2cf30de8ed 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
@@ -417,12 +417,6 @@ pub struct NexixpayCard {
cvv: Secret<String>,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-struct Recurrence {
- action: String,
-}
-
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PaymentsResponse {
diff --git a/crates/hyperswitch_connectors/src/connectors/payload/responses.rs b/crates/hyperswitch_connectors/src/connectors/payload/responses.rs
index 888213be52..f04e6b73a6 100644
--- a/crates/hyperswitch_connectors/src/connectors/payload/responses.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payload/responses.rs
@@ -49,14 +49,6 @@ pub struct PayloadCardsResponseData {
pub response_type: Option<String>,
}
-#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
-pub struct PayloadCardResponse {
- pub card_brand: String,
- pub card_number: String, // Masked card number like "xxxxxxxxxxxx4242"
- pub card_type: String,
- pub expiry: Secret<String>,
-}
-
// Type definition for Refund Response
// Added based on assumptions since this is not provided in the documentation
#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]
diff --git a/crates/hyperswitch_connectors/src/connectors/signifyd/transformers/api.rs b/crates/hyperswitch_connectors/src/connectors/signifyd/transformers/api.rs
index 4df231a918..c23bc40a97 100644
--- a/crates/hyperswitch_connectors/src/connectors/signifyd/transformers/api.rs
+++ b/crates/hyperswitch_connectors/src/connectors/signifyd/transformers/api.rs
@@ -163,7 +163,7 @@ impl TryFrom<&FrmSaleRouterData> for SignifydPaymentsSaleRequest {
item_is_digital: order_detail
.product_type
.as_ref()
- .map(|product| (product == &common_enums::ProductType::Digital)),
+ .map(|product| product == &common_enums::ProductType::Digital),
})
.collect::<Vec<_>>();
let metadata: SignifydFrmMetadata = item
@@ -397,7 +397,7 @@ impl TryFrom<&FrmCheckoutRouterData> for SignifydPaymentsCheckoutRequest {
item_is_digital: order_detail
.product_type
.as_ref()
- .map(|product| (product == &common_enums::ProductType::Digital)),
+ .map(|product| product == &common_enums::ProductType::Digital),
})
.collect::<Vec<_>>();
let metadata: SignifydFrmMetadata = item
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs
index a43ffb7cfa..d8aeea2b3b 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs
@@ -161,16 +161,6 @@ pub struct BillingAddress {
pub country_code: common_enums::CountryAlpha2,
}
-#[derive(
- Clone, Copy, Default, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize,
-)]
-#[serde(rename_all = "camelCase")]
-pub enum Channel {
- #[default]
- Ecom,
- Moto,
-}
-
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Customer {
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/response.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/response.rs
index b1a3a86a04..3f684a694d 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay/response.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay/response.rs
@@ -258,11 +258,6 @@ pub struct EventLinks {
pub events: Option<String>,
}
-#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
-pub struct PaymentLink {
- pub href: String,
-}
-
pub fn get_resource_id<T, F>(
response: WorldpayPaymentsResponse,
connector_transaction_id: Option<String>,
@@ -455,19 +450,5 @@ pub struct WorldpayWebhookEventType {
pub event_details: EventDetails,
}
-#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
-#[serde(rename_all = "camelCase")]
-pub enum WorldpayWebhookStatus {
- SentForSettlement,
- Authorized,
- SentForAuthorization,
- Cancelled,
- Error,
- Expired,
- Refused,
- SentForRefund,
- RefundFailed,
-}
-
/// Worldpay's unique reference ID for a request
pub(super) const WP_CORRELATION_ID: &str = "WP-CorrelationId";
diff --git a/crates/router/src/core/fraud_check/operation.rs b/crates/router/src/core/fraud_check/operation.rs
index 4750fd1117..b1b9540d9c 100644
--- a/crates/router/src/core/fraud_check/operation.rs
+++ b/crates/router/src/core/fraud_check/operation.rs
@@ -22,7 +22,7 @@ pub trait FraudCheckOperation<F, D>: Send + std::fmt::Debug {
Err(report!(errors::ApiErrorResponse::InternalServerError))
.attach_printable_lazy(|| format!("get tracker interface not found for {self:?}"))
}
- fn to_domain(&self) -> RouterResult<&(dyn Domain<F, D>)> {
+ fn to_domain(&self) -> RouterResult<&dyn Domain<F, D>> {
Err(report!(errors::ApiErrorResponse::InternalServerError))
.attach_printable_lazy(|| format!("domain interface not found for {self:?}"))
}
diff --git a/crates/router/src/core/fraud_check/operation/fraud_check_post.rs b/crates/router/src/core/fraud_check/operation/fraud_check_post.rs
index 7dbe590ca3..5ebeadf900 100644
--- a/crates/router/src/core/fraud_check/operation/fraud_check_post.rs
+++ b/crates/router/src/core/fraud_check/operation/fraud_check_post.rs
@@ -54,7 +54,7 @@ where
fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<PaymentToFrmData> + Send + Sync)> {
Ok(*self)
}
- fn to_domain(&self) -> RouterResult<&(dyn Domain<F, D>)> {
+ fn to_domain(&self) -> RouterResult<&dyn Domain<F, D>> {
Ok(*self)
}
fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<FrmData, F, D> + Send + Sync)> {
@@ -74,7 +74,7 @@ where
fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<PaymentToFrmData> + Send + Sync)> {
Ok(self)
}
- fn to_domain(&self) -> RouterResult<&(dyn Domain<F, D>)> {
+ fn to_domain(&self) -> RouterResult<&dyn Domain<F, D>> {
Ok(self)
}
fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<FrmData, F, D> + Send + Sync)> {
diff --git a/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs b/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs
index 0c42bdeacb..829fa33311 100644
--- a/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs
+++ b/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs
@@ -45,7 +45,7 @@ where
fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<PaymentToFrmData> + Send + Sync)> {
Ok(*self)
}
- fn to_domain(&self) -> RouterResult<&(dyn Domain<F, D>)> {
+ fn to_domain(&self) -> RouterResult<&dyn Domain<F, D>> {
Ok(*self)
}
fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<FrmData, F, D> + Send + Sync)> {
@@ -61,7 +61,7 @@ where
fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<PaymentToFrmData> + Send + Sync)> {
Ok(self)
}
- fn to_domain(&self) -> RouterResult<&(dyn Domain<F, D>)> {
+ fn to_domain(&self) -> RouterResult<&dyn Domain<F, D>> {
Ok(self)
}
fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<FrmData, F, D> + Send + Sync)> {
diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs
index e43c12da15..2cead7d050 100644
--- a/crates/router/src/db.rs
+++ b/crates/router/src/db.rs
@@ -153,7 +153,7 @@ pub trait StorageInterface:
{
fn get_scheduler_db(&self) -> Box<dyn scheduler::SchedulerInterface>;
fn get_payment_methods_store(&self) -> Box<dyn PaymentMethodsStorageInterface>;
- fn get_cache_store(&self) -> Box<(dyn RedisConnInterface + Send + Sync + 'static)>;
+ fn get_cache_store(&self) -> Box<dyn RedisConnInterface + Send + Sync + 'static>;
}
#[async_trait::async_trait]
@@ -168,7 +168,7 @@ pub trait GlobalStorageInterface:
+ RedisConnInterface
+ 'static
{
- fn get_cache_store(&self) -> Box<(dyn RedisConnInterface + Send + Sync + 'static)>;
+ fn get_cache_store(&self) -> Box<dyn RedisConnInterface + Send + Sync + 'static>;
}
#[async_trait::async_trait]
@@ -226,14 +226,14 @@ impl StorageInterface for Store {
Box::new(self.clone())
}
- fn get_cache_store(&self) -> Box<(dyn RedisConnInterface + Send + Sync + 'static)> {
+ fn get_cache_store(&self) -> Box<dyn RedisConnInterface + Send + Sync + 'static> {
Box::new(self.clone())
}
}
#[async_trait::async_trait]
impl GlobalStorageInterface for Store {
- fn get_cache_store(&self) -> Box<(dyn RedisConnInterface + Send + Sync + 'static)> {
+ fn get_cache_store(&self) -> Box<dyn RedisConnInterface + Send + Sync + 'static> {
Box::new(self.clone())
}
}
@@ -249,14 +249,14 @@ impl StorageInterface for MockDb {
Box::new(self.clone())
}
- fn get_cache_store(&self) -> Box<(dyn RedisConnInterface + Send + Sync + 'static)> {
+ fn get_cache_store(&self) -> Box<dyn RedisConnInterface + Send + Sync + 'static> {
Box::new(self.clone())
}
}
#[async_trait::async_trait]
impl GlobalStorageInterface for MockDb {
- fn get_cache_store(&self) -> Box<(dyn RedisConnInterface + Send + Sync + 'static)> {
+ fn get_cache_store(&self) -> Box<dyn RedisConnInterface + Send + Sync + 'static> {
Box::new(self.clone())
}
}
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 68ef8d1961..8bbee6ab8c 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -3316,13 +3316,13 @@ impl StorageInterface for KafkaStore {
Box::new(self.clone())
}
- fn get_cache_store(&self) -> Box<(dyn RedisConnInterface + Send + Sync + 'static)> {
+ fn get_cache_store(&self) -> Box<dyn RedisConnInterface + Send + Sync + 'static> {
Box::new(self.clone())
}
}
impl GlobalStorageInterface for KafkaStore {
- fn get_cache_store(&self) -> Box<(dyn RedisConnInterface + Send + Sync + 'static)> {
+ fn get_cache_store(&self) -> Box<dyn RedisConnInterface + Send + Sync + 'static> {
Box::new(self.clone())
}
}
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 0d7da850f1..696f47a4c0 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -233,7 +233,7 @@ impl SessionStateInfo for SessionState {
fn session_state(&self) -> SessionState {
self.clone()
}
- fn global_store(&self) -> Box<(dyn GlobalStorageInterface)> {
+ fn global_store(&self) -> Box<dyn GlobalStorageInterface> {
self.global_store.to_owned()
}
}
diff --git a/crates/router/src/services/api/client.rs b/crates/router/src/services/api/client.rs
index d690ebd327..9e54e673b9 100644
--- a/crates/router/src/services/api/client.rs
+++ b/crates/router/src/services/api/client.rs
@@ -24,10 +24,7 @@ pub trait RequestBuilder: Send + Sync {
fn send(
self,
) -> CustomResult<
- Box<
- (dyn core::future::Future<Output = Result<reqwest::Response, reqwest::Error>>
- + 'static),
- >,
+ Box<dyn core::future::Future<Output = Result<reqwest::Response, reqwest::Error>> + 'static>,
ApiClientError,
>;
}
@@ -154,10 +151,7 @@ impl RequestBuilder for RouterRequestBuilder {
fn send(
self,
) -> CustomResult<
- Box<
- (dyn core::future::Future<Output = Result<reqwest::Response, reqwest::Error>>
- + 'static),
- >,
+ Box<dyn core::future::Future<Output = Result<reqwest::Response, reqwest::Error>> + 'static>,
ApiClientError,
> {
Ok(Box::new(