chore: address Rust 1.90.0 clippy lints (#9511)

This commit is contained in:
Gaurav Rawat
2025-09-26 00:06:42 +05:30
committed by GitHub
parent 239b6d37c6
commit 198fe07891
16 changed files with 19 additions and 106 deletions

View File

@ -112,7 +112,7 @@ where
fn encode_by_ref( fn encode_by_ref(
&self, &self,
buf: &mut PgArgumentBuffer, 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) <String as Encode<'q, Postgres>>::encode(self.0.to_string(), buf)
} }
fn size_hint(&self) -> usize { fn size_hint(&self) -> usize {

View File

@ -115,12 +115,6 @@ struct CreditCardDetails {
card_code: Option<Secret<String>>, card_code: Option<Secret<String>>,
} }
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
struct BankAccountDetails {
account_number: Secret<String>,
}
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
enum PaymentDetails { enum PaymentDetails {

View File

@ -287,13 +287,6 @@ pub enum UsageMode {
UseNetworkToken, 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)] #[derive(Default, Debug, Serialize)]
pub struct GlobalPayPaymentMethodsRequest { pub struct GlobalPayPaymentMethodsRequest {
pub reference: String, pub reference: String,

View File

@ -49,19 +49,6 @@ pub struct Card {
pub brand_reference: Option<Secret<String>>, 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. /// Indicates where a transaction is in its lifecycle.
#[derive(Clone, Copy, Debug, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, Serialize, Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
@ -112,18 +99,6 @@ pub enum GlobalpayWebhookStatus {
Unknown, 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)] #[derive(Debug, Serialize, Deserialize)]
pub struct GlobalpayPaymentMethodsResponse { pub struct GlobalpayPaymentMethodsResponse {
#[serde(rename = "id")] #[serde(rename = "id")]

View File

@ -417,12 +417,6 @@ pub struct NexixpayCard {
cvv: Secret<String>, cvv: Secret<String>,
} }
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
struct Recurrence {
action: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PaymentsResponse { pub struct PaymentsResponse {

View File

@ -49,14 +49,6 @@ pub struct PayloadCardsResponseData {
pub response_type: Option<String>, 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 // Type definition for Refund Response
// Added based on assumptions since this is not provided in the documentation // Added based on assumptions since this is not provided in the documentation
#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)] #[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]

View File

@ -163,7 +163,7 @@ impl TryFrom<&FrmSaleRouterData> for SignifydPaymentsSaleRequest {
item_is_digital: order_detail item_is_digital: order_detail
.product_type .product_type
.as_ref() .as_ref()
.map(|product| (product == &common_enums::ProductType::Digital)), .map(|product| product == &common_enums::ProductType::Digital),
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let metadata: SignifydFrmMetadata = item let metadata: SignifydFrmMetadata = item
@ -397,7 +397,7 @@ impl TryFrom<&FrmCheckoutRouterData> for SignifydPaymentsCheckoutRequest {
item_is_digital: order_detail item_is_digital: order_detail
.product_type .product_type
.as_ref() .as_ref()
.map(|product| (product == &common_enums::ProductType::Digital)), .map(|product| product == &common_enums::ProductType::Digital),
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let metadata: SignifydFrmMetadata = item let metadata: SignifydFrmMetadata = item

View File

@ -161,16 +161,6 @@ pub struct BillingAddress {
pub country_code: common_enums::CountryAlpha2, 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)] #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Customer { pub struct Customer {

View File

@ -258,11 +258,6 @@ pub struct EventLinks {
pub events: Option<String>, pub events: Option<String>,
} }
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct PaymentLink {
pub href: String,
}
pub fn get_resource_id<T, F>( pub fn get_resource_id<T, F>(
response: WorldpayPaymentsResponse, response: WorldpayPaymentsResponse,
connector_transaction_id: Option<String>, connector_transaction_id: Option<String>,
@ -455,19 +450,5 @@ pub struct WorldpayWebhookEventType {
pub event_details: EventDetails, 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 /// Worldpay's unique reference ID for a request
pub(super) const WP_CORRELATION_ID: &str = "WP-CorrelationId"; pub(super) const WP_CORRELATION_ID: &str = "WP-CorrelationId";

View File

@ -22,7 +22,7 @@ pub trait FraudCheckOperation<F, D>: Send + std::fmt::Debug {
Err(report!(errors::ApiErrorResponse::InternalServerError)) Err(report!(errors::ApiErrorResponse::InternalServerError))
.attach_printable_lazy(|| format!("get tracker interface not found for {self:?}")) .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)) Err(report!(errors::ApiErrorResponse::InternalServerError))
.attach_printable_lazy(|| format!("domain interface not found for {self:?}")) .attach_printable_lazy(|| format!("domain interface not found for {self:?}"))
} }

View File

@ -54,7 +54,7 @@ where
fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<PaymentToFrmData> + Send + Sync)> { fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<PaymentToFrmData> + Send + Sync)> {
Ok(*self) Ok(*self)
} }
fn to_domain(&self) -> RouterResult<&(dyn Domain<F, D>)> { fn to_domain(&self) -> RouterResult<&dyn Domain<F, D>> {
Ok(*self) Ok(*self)
} }
fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<FrmData, F, D> + Send + Sync)> { 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)> { fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<PaymentToFrmData> + Send + Sync)> {
Ok(self) Ok(self)
} }
fn to_domain(&self) -> RouterResult<&(dyn Domain<F, D>)> { fn to_domain(&self) -> RouterResult<&dyn Domain<F, D>> {
Ok(self) Ok(self)
} }
fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<FrmData, F, D> + Send + Sync)> { fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<FrmData, F, D> + Send + Sync)> {

View File

@ -45,7 +45,7 @@ where
fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<PaymentToFrmData> + Send + Sync)> { fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<PaymentToFrmData> + Send + Sync)> {
Ok(*self) Ok(*self)
} }
fn to_domain(&self) -> RouterResult<&(dyn Domain<F, D>)> { fn to_domain(&self) -> RouterResult<&dyn Domain<F, D>> {
Ok(*self) Ok(*self)
} }
fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<FrmData, F, D> + Send + Sync)> { 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)> { fn to_get_tracker(&self) -> RouterResult<&(dyn GetTracker<PaymentToFrmData> + Send + Sync)> {
Ok(self) Ok(self)
} }
fn to_domain(&self) -> RouterResult<&(dyn Domain<F, D>)> { fn to_domain(&self) -> RouterResult<&dyn Domain<F, D>> {
Ok(self) Ok(self)
} }
fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<FrmData, F, D> + Send + Sync)> { fn to_update_tracker(&self) -> RouterResult<&(dyn UpdateTracker<FrmData, F, D> + Send + Sync)> {

View File

@ -153,7 +153,7 @@ pub trait StorageInterface:
{ {
fn get_scheduler_db(&self) -> Box<dyn scheduler::SchedulerInterface>; fn get_scheduler_db(&self) -> Box<dyn scheduler::SchedulerInterface>;
fn get_payment_methods_store(&self) -> Box<dyn PaymentMethodsStorageInterface>; 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] #[async_trait::async_trait]
@ -168,7 +168,7 @@ pub trait GlobalStorageInterface:
+ RedisConnInterface + RedisConnInterface
+ 'static + '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] #[async_trait::async_trait]
@ -226,14 +226,14 @@ impl StorageInterface for Store {
Box::new(self.clone()) 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()) Box::new(self.clone())
} }
} }
#[async_trait::async_trait] #[async_trait::async_trait]
impl GlobalStorageInterface for Store { 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()) Box::new(self.clone())
} }
} }
@ -249,14 +249,14 @@ impl StorageInterface for MockDb {
Box::new(self.clone()) 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()) Box::new(self.clone())
} }
} }
#[async_trait::async_trait] #[async_trait::async_trait]
impl GlobalStorageInterface for MockDb { 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()) Box::new(self.clone())
} }
} }

View File

@ -3316,13 +3316,13 @@ impl StorageInterface for KafkaStore {
Box::new(self.clone()) 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()) Box::new(self.clone())
} }
} }
impl GlobalStorageInterface for KafkaStore { 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()) Box::new(self.clone())
} }
} }

View File

@ -233,7 +233,7 @@ impl SessionStateInfo for SessionState {
fn session_state(&self) -> SessionState { fn session_state(&self) -> SessionState {
self.clone() self.clone()
} }
fn global_store(&self) -> Box<(dyn GlobalStorageInterface)> { fn global_store(&self) -> Box<dyn GlobalStorageInterface> {
self.global_store.to_owned() self.global_store.to_owned()
} }
} }

View File

@ -24,10 +24,7 @@ pub trait RequestBuilder: Send + Sync {
fn send( fn send(
self, self,
) -> CustomResult< ) -> CustomResult<
Box< Box<dyn core::future::Future<Output = Result<reqwest::Response, reqwest::Error>> + 'static>,
(dyn core::future::Future<Output = Result<reqwest::Response, reqwest::Error>>
+ 'static),
>,
ApiClientError, ApiClientError,
>; >;
} }
@ -154,10 +151,7 @@ impl RequestBuilder for RouterRequestBuilder {
fn send( fn send(
self, self,
) -> CustomResult< ) -> CustomResult<
Box< Box<dyn core::future::Future<Output = Result<reqwest::Response, reqwest::Error>> + 'static>,
(dyn core::future::Future<Output = Result<reqwest::Response, reqwest::Error>>
+ 'static),
>,
ApiClientError, ApiClientError,
> { > {
Ok(Box::new( Ok(Box::new(