chore: address Rust 1.80 clippy lints (#5447)

This commit is contained in:
Chethan Rao
2024-07-26 15:44:39 +05:30
committed by GitHub
parent 2bee694d5b
commit 074e90c9f9
17 changed files with 41 additions and 150 deletions

View File

@ -145,20 +145,6 @@ impl_api_event_type!(
)
);
#[cfg(feature = "stripe")]
impl_api_event_type!(
Miscellaneous,
(
StripeSetupIntentResponse,
StripeRefundResponse,
StripePaymentIntentListResponse,
StripePaymentIntentResponse,
CustomerDeleteResponse,
CustomerPaymentMethodListResponse,
CreateCustomerResponse
)
);
impl<T> ApiEventMetric for MetricsResponse<T> {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Miscellaneous)

View File

@ -17,9 +17,6 @@ use crate::file_storage::{FileStorageError, FileStorageInterface};
/// The file path is generated based on the workspace path and the provided file key.
fn get_file_path(file_key: impl AsRef<str>) -> PathBuf {
let mut file_path = PathBuf::new();
#[cfg(feature = "logs")]
file_path.push(router_env::env::workspace_path());
#[cfg(not(feature = "logs"))]
file_path.push(std::env::current_dir().unwrap_or(".".into()));
file_path.push("files");

View File

@ -28,7 +28,7 @@ pub async fn payment_intents_create(
Err(err) => return api::log_and_return_error_response(err),
};
tracing::Span::current().record("payment_id", &payload.id.clone().unwrap_or_default());
tracing::Span::current().record("payment_id", payload.id.clone().unwrap_or_default());
logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?payload);
@ -170,7 +170,7 @@ pub async fn payment_intents_retrieve_with_gateway_creds(
_ => Flow::PaymentsRetrieve,
};
tracing::Span::current().record("flow", &flow.to_string());
tracing::Span::current().record("flow", flow.to_string());
let locking_action = payload.get_locking_input(flow.clone());
Box::pin(wrap::compatibility_api_wrap::<
@ -361,7 +361,7 @@ pub async fn payment_intents_capture(
}
};
tracing::Span::current().record("payment_id", &stripe_payload.payment_id.clone());
tracing::Span::current().record("payment_id", stripe_payload.payment_id.clone());
logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?stripe_payload);
@ -423,7 +423,7 @@ pub async fn payment_intents_cancel(
}
};
tracing::Span::current().record("payment_id", &payment_id.clone());
tracing::Span::current().record("payment_id", payment_id.clone());
logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?stripe_payload);

View File

@ -26,7 +26,7 @@ pub async fn refund_create(
Err(err) => return api::log_and_return_error_response(err),
};
tracing::Span::current().record("payment_id", &payload.payment_intent.clone());
tracing::Span::current().record("payment_id", payload.payment_intent.clone());
logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?payload);
@ -76,7 +76,7 @@ pub async fn refund_retrieve_with_gateway_creds(
_ => Flow::RefundsRetrieve,
};
tracing::Span::current().record("flow", &flow.to_string());
tracing::Span::current().record("flow", flow.to_string());
Box::pin(wrap::compatibility_api_wrap::<
_,

View File

@ -45,16 +45,6 @@ pub struct CmdLineConf {
/// Application will look for "config/config.toml" if this option isn't specified.
#[arg(short = 'f', long, value_name = "FILE")]
pub config_path: Option<PathBuf>,
#[command(subcommand)]
pub subcommand: Option<Subcommand>,
}
#[derive(clap::Parser)]
pub enum Subcommand {
#[cfg(feature = "openapi")]
/// Generate the OpenAPI specification file from code.
GenerateOpenapiSpec,
}
#[derive(Debug, Deserialize, Clone, Default)]

View File

@ -688,12 +688,6 @@ pub struct MbwayData {
telephone_number: Secret<String>,
}
#[derive(Debug, Clone, Serialize)]
pub struct WalleyData {
#[serde(rename = "type")]
payment_type: PaymentType,
}
#[derive(Debug, Clone, Serialize)]
pub struct SamsungPayPmData {
#[serde(rename = "type")]
@ -702,12 +696,6 @@ pub struct SamsungPayPmData {
samsung_pay_token: Secret<String>,
}
#[derive(Debug, Clone, Serialize)]
pub struct PayBrightData {
#[serde(rename = "type")]
payment_type: PaymentType,
}
#[derive(Debug, Clone, Serialize)]
pub struct OnlineBankingCzechRepublicData {
#[serde(rename = "type")]

View File

@ -133,12 +133,6 @@ pub struct BluesnapGooglePayObject {
payment_method_data: utils::GooglePayWalletData,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BluesnapApplePayObject {
token: payments::ApplePayWalletData,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum BluesnapWalletTypes {

View File

@ -459,11 +459,6 @@ pub struct BokuErrorResponse {
pub reason: Option<String>,
}
#[derive(Debug, Serialize)]
pub struct BokuConnMetaData {
country: String,
}
fn get_hosted_data(item: &types::PaymentsAuthorizeRouterData) -> Option<BokuHostedData> {
item.return_url
.clone()

View File

@ -462,12 +462,6 @@ pub struct CardDetails {
pub card_cvv: Secret<String>,
}
#[derive(Debug, Serialize, Eq, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct BankDetails {
billing_email: Email,
}
pub struct MollieAuthType {
pub(super) api_key: Secret<String>,
pub(super) profile_token: Option<Secret<String>>,

View File

@ -1,4 +1,4 @@
use common_utils::pii::{Email, IpAddress};
use common_utils::pii::IpAddress;
use diesel_models::enums::RefundStatus;
use masking::{ExposeInterface, Secret};
use serde::{Deserialize, Serialize};
@ -74,20 +74,20 @@ pub struct PowertranzCard {
card_cvv: Secret<String>,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "PascalCase")]
pub struct PowertranzAddressDetails {
first_name: Option<Secret<String>>,
last_name: Option<Secret<String>>,
line1: Option<Secret<String>>,
line2: Option<Secret<String>>,
city: Option<String>,
country: Option<enums::CountryAlpha2>,
state: Option<Secret<String>>,
postal_code: Option<Secret<String>>,
email_address: Option<Email>,
phone_number: Option<Secret<String>>,
}
// #[derive(Debug, Serialize)]
// #[serde(rename_all = "PascalCase")]
// pub struct PowertranzAddressDetails {
// first_name: Option<Secret<String>>,
// last_name: Option<Secret<String>>,
// line1: Option<Secret<String>>,
// line2: Option<Secret<String>>,
// city: Option<String>,
// country: Option<enums::CountryAlpha2>,
// state: Option<Secret<String>>,
// postal_code: Option<Secret<String>>,
// email_address: Option<Email>,
// phone_number: Option<Secret<String>>,
// }
#[derive(Debug, Deserialize)]
#[serde(rename_all = "PascalCase")]

View File

@ -634,56 +634,3 @@ impl UserRoleInterface for MockDb {
Ok(filtered_roles)
}
}
#[cfg(feature = "kafka_events")]
#[async_trait::async_trait]
impl UserRoleInterface for super::KafkaStore {
async fn insert_user_role(
&self,
user_role: storage::UserRoleNew,
) -> CustomResult<storage::UserRole, errors::StorageError> {
self.diesel_store.insert_user_role(user_role).await
}
async fn update_user_role_by_user_id_merchant_id(
&self,
user_id: &str,
merchant_id: &common_utils::id_type::MerchantId,
update: storage::UserRoleUpdate,
) -> CustomResult<storage::UserRole, errors::StorageError> {
self.diesel_store
.update_user_role_by_user_id_merchant_id(user_id, merchant_id, update)
.await
}
async fn find_user_role_by_user_id(
&self,
user_id: &str,
version: enums::UserRoleVersion,
) -> CustomResult<storage::UserRole, errors::StorageError> {
self.diesel_store
.find_user_role_by_user_id(user_id, version)
.await
}
async fn delete_user_role_by_user_id_merchant_id(
&self,
user_id: &str,
merchant_id: &common_utils::id_type::MerchantId,
) -> CustomResult<storage::UserRole, errors::StorageError> {
self.diesel_store
.delete_user_role_by_user_id_merchant_id(user_id, merchant_id)
.await
}
async fn list_user_roles_by_user_id(
&self,
user_id: &str,
) -> CustomResult<Vec<storage::UserRole>, errors::StorageError> {
self.diesel_store.list_user_roles_by_user_id(user_id).await
}
async fn list_user_roles_by_merchant_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
) -> CustomResult<Vec<storage::UserRole>, errors::StorageError> {
self.diesel_store
.list_user_roles_by_merchant_id(merchant_id)
.await
}
}

View File

@ -108,7 +108,7 @@ pub async fn payments_create(
tracing::Span::current().record(
"payment_id",
&payload
payload
.payment_id
.as_ref()
.map(|payment_id_type| payment_id_type.get_payment_intent_id())
@ -254,8 +254,8 @@ pub async fn payments_retrieve(
..Default::default()
};
tracing::Span::current().record("payment_id", &path.to_string());
tracing::Span::current().record("flow", &flow.to_string());
tracing::Span::current().record("payment_id", path.to_string());
tracing::Span::current().record("flow", flow.to_string());
let (auth_type, auth_flow) =
match auth::check_client_secret_and_get_auth(req.headers(), &payload) {
@ -334,7 +334,7 @@ pub async fn payments_retrieve_with_gateway_creds(
};
tracing::Span::current().record("payment_id", &json_payload.payment_id);
tracing::Span::current().record("flow", &flow.to_string());
tracing::Span::current().record("flow", flow.to_string());
let locking_action = payload.get_locking_input(flow.clone());

View File

@ -81,7 +81,7 @@ pub async fn refunds_retrieve(
_ => Flow::RefundsRetrieve,
};
tracing::Span::current().record("flow", &flow.to_string());
tracing::Span::current().record("flow", flow.to_string());
Box::pin(api::server_wrap(
flow,
@ -132,7 +132,7 @@ pub async fn refunds_retrieve_with_body(
_ => Flow::RefundsRetrieve,
};
tracing::Span::current().record("flow", &flow.to_string());
tracing::Span::current().record("flow", flow.to_string());
Box::pin(api::server_wrap(
flow,

View File

@ -126,7 +126,7 @@ where
// If needed add an error stack as follows
// connector_integration.build_request(req).attach_printable("Failed to build request");
tracing::Span::current().record("connector_name", &req.connector);
tracing::Span::current().record("payment_method", &req.payment_method.to_string());
tracing::Span::current().record("payment_method", req.payment_method.to_string());
logger::debug!(connector_request=?connector_request);
let mut router_data = req.clone();
match call_connector_action {