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.76 clippy lints (#3605)

Chethan Raoc55eb0afca9d
diff --git a/crates/router/src/compatibility/wrap.rs b/crates/router/src/compatibility/wrap.rs
index d3ca0172f2..da14475f12 100644
--- a/crates/router/src/compatibility/wrap.rs
+++ b/crates/router/src/compatibility/wrap.rs
@@ -42,7 +42,7 @@ where
let start_instant = Instant::now();
logger::info!(tag = ?Tag::BeginRequest, payload = ?payload);
- let res = match metrics::request::record_request_time_metric(
+ let server_wrap_util_res = metrics::request::record_request_time_metric(
api::server_wrap_util(
&flow,
state.clone().into(),
@@ -58,7 +58,9 @@ where
.map(|response| {
logger::info!(api_response =? response);
response
- }) {
+ });
+
+ let res = match server_wrap_util_res {
Ok(api::ApplicationResponse::Json(response)) => {
let response = S::try_from(response);
match response {
diff --git a/crates/router/src/db/address.rs b/crates/router/src/db/address.rs
index 689d1f9c78..99006752f5 100644
--- a/crates/router/src/db/address.rs
+++ b/crates/router/src/db/address.rs
@@ -656,7 +656,7 @@ impl AddressInterface for MockDb {
address_update: storage_types::AddressUpdate,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::Address, errors::StorageError> {
- match self
+ let updated_addr = self
.addresses
.lock()
.await
@@ -667,7 +667,8 @@ impl AddressInterface for MockDb {
AddressUpdateInternal::from(address_update).create_address(a.clone());
*a = address_updated.clone();
address_updated
- }) {
+ });
+ match updated_addr {
Some(address_updated) => address_updated
.convert(key_store.key.get_inner())
.await
@@ -687,7 +688,7 @@ impl AddressInterface for MockDb {
key_store: &domain::MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<domain::Address, errors::StorageError> {
- match self
+ let updated_addr = self
.addresses
.lock()
.await
@@ -698,7 +699,8 @@ impl AddressInterface for MockDb {
AddressUpdateInternal::from(address_update).create_address(a.clone());
*a = address_updated.clone();
address_updated
- }) {
+ });
+ match updated_addr {
Some(address_updated) => address_updated
.convert(key_store.key.get_inner())
.await
@@ -757,7 +759,7 @@ impl AddressInterface for MockDb {
address_update: storage_types::AddressUpdate,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<Vec<domain::Address>, errors::StorageError> {
- match self
+ let updated_addr = self
.addresses
.lock()
.await
@@ -771,7 +773,8 @@ impl AddressInterface for MockDb {
AddressUpdateInternal::from(address_update).create_address(a.clone());
*a = address_updated.clone();
address_updated
- }) {
+ });
+ match updated_addr {
Some(address) => {
let address: domain::Address = address
.convert(key_store.key.get_inner())
diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs
index 3718b962b4..0dd20721c3 100644
--- a/crates/router/src/db/merchant_connector_account.rs
+++ b/crates/router/src/db/merchant_connector_account.rs
@@ -691,7 +691,7 @@ impl MerchantConnectorAccountInterface for MockDb {
merchant_connector_account: storage::MerchantConnectorAccountUpdateInternal,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
- match self
+ let mca_update_res = self
.merchant_connector_accounts
.lock()
.await
@@ -709,8 +709,9 @@ impl MerchantConnectorAccountInterface for MockDb {
.await
.change_context(errors::StorageError::DecryptionError)
})
- .await
- {
+ .await;
+
+ match mca_update_res {
Some(result) => result,
None => {
return Err(errors::StorageError::ValueNotFound(
diff --git a/crates/router/src/db/payment_method.rs b/crates/router/src/db/payment_method.rs
index dd7cbedd0f..b109d1fe5b 100644
--- a/crates/router/src/db/payment_method.rs
+++ b/crates/router/src/db/payment_method.rs
@@ -212,7 +212,7 @@ impl PaymentMethodInterface for MockDb {
payment_method: storage::PaymentMethod,
payment_method_update: storage::PaymentMethodUpdate,
) -> CustomResult<storage::PaymentMethod, errors::StorageError> {
- match self
+ let pm_update_res = self
.payment_methods
.lock()
.await
@@ -224,7 +224,9 @@ impl PaymentMethodInterface for MockDb {
.create_payment_method(pm.clone());
*pm = payment_method_updated.clone();
payment_method_updated
- }) {
+ });
+
+ match pm_update_res {
Some(result) => Ok(result),
None => Err(errors::StorageError::ValueNotFound(
"cannot find payment method to update".to_string(),
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 5a6ff7e9b6..28405c001e 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -1083,7 +1083,7 @@ where
let start_instant = Instant::now();
logger::info!(tag = ?Tag::BeginRequest, payload = ?payload);
- let res = match metrics::request::record_request_time_metric(
+ let server_wrap_util_res = metrics::request::record_request_time_metric(
server_wrap_util(
&flow,
state.clone(),
@@ -1099,7 +1099,9 @@ where
.map(|response| {
logger::info!(api_response =? response);
response
- }) {
+ });
+
+ let res = match server_wrap_util_res {
Ok(ApplicationResponse::Json(response)) => match serde_json::to_string(&response) {
Ok(res) => http_response_json(res),
Err(_) => http_response_err(
diff --git a/crates/scheduler/src/utils.rs b/crates/scheduler/src/utils.rs
index 32fd97fca3..f6a340e9d5 100644
--- a/crates/scheduler/src/utils.rs
+++ b/crates/scheduler/src/utils.rs
@@ -109,7 +109,7 @@ where
{
Ok(x) => Ok(x),
Err(mut err) => {
- match state
+ let update_res = state
.process_tracker_update_process_status_by_ids(
pt_batch.trackers.iter().map(|process| process.id.clone()).collect(),
storage::ProcessTrackerUpdate::StatusUpdate {
@@ -123,12 +123,14 @@ where
}, |count| {
logger::debug!("Updated status of {count} processes");
Ok(())
- }) {
- Ok(_) => (),
- Err(inner_err) => {
- err.extend_one(inner_err);
- }
- };
+ });
+
+ match update_res {
+ Ok(_) => (),
+ Err(inner_err) => {
+ err.extend_one(inner_err);
+ }
+ };
Err(err)
}
diff --git a/crates/test_utils/src/newman_runner.rs b/crates/test_utils/src/newman_runner.rs
index a6e0268e2c..961853548a 100644
--- a/crates/test_utils/src/newman_runner.rs
+++ b/crates/test_utils/src/newman_runner.rs
@@ -56,7 +56,6 @@ where
// Open the file in write mode or create it if it doesn't exist
let mut file = std::fs::OpenOptions::new()
- .write(true)
.append(true)
.create(true)
.open(file_path)?;