mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
chore: address Rust 1.76 clippy lints (#3605)
This commit is contained in:
@ -42,7 +42,7 @@ where
|
|||||||
let start_instant = Instant::now();
|
let start_instant = Instant::now();
|
||||||
logger::info!(tag = ?Tag::BeginRequest, payload = ?payload);
|
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(
|
api::server_wrap_util(
|
||||||
&flow,
|
&flow,
|
||||||
state.clone().into(),
|
state.clone().into(),
|
||||||
@ -58,7 +58,9 @@ where
|
|||||||
.map(|response| {
|
.map(|response| {
|
||||||
logger::info!(api_response =? response);
|
logger::info!(api_response =? response);
|
||||||
response
|
response
|
||||||
}) {
|
});
|
||||||
|
|
||||||
|
let res = match server_wrap_util_res {
|
||||||
Ok(api::ApplicationResponse::Json(response)) => {
|
Ok(api::ApplicationResponse::Json(response)) => {
|
||||||
let response = S::try_from(response);
|
let response = S::try_from(response);
|
||||||
match response {
|
match response {
|
||||||
|
|||||||
@ -656,7 +656,7 @@ impl AddressInterface for MockDb {
|
|||||||
address_update: storage_types::AddressUpdate,
|
address_update: storage_types::AddressUpdate,
|
||||||
key_store: &domain::MerchantKeyStore,
|
key_store: &domain::MerchantKeyStore,
|
||||||
) -> CustomResult<domain::Address, errors::StorageError> {
|
) -> CustomResult<domain::Address, errors::StorageError> {
|
||||||
match self
|
let updated_addr = self
|
||||||
.addresses
|
.addresses
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
@ -667,7 +667,8 @@ impl AddressInterface for MockDb {
|
|||||||
AddressUpdateInternal::from(address_update).create_address(a.clone());
|
AddressUpdateInternal::from(address_update).create_address(a.clone());
|
||||||
*a = address_updated.clone();
|
*a = address_updated.clone();
|
||||||
address_updated
|
address_updated
|
||||||
}) {
|
});
|
||||||
|
match updated_addr {
|
||||||
Some(address_updated) => address_updated
|
Some(address_updated) => address_updated
|
||||||
.convert(key_store.key.get_inner())
|
.convert(key_store.key.get_inner())
|
||||||
.await
|
.await
|
||||||
@ -687,7 +688,7 @@ impl AddressInterface for MockDb {
|
|||||||
key_store: &domain::MerchantKeyStore,
|
key_store: &domain::MerchantKeyStore,
|
||||||
_storage_scheme: MerchantStorageScheme,
|
_storage_scheme: MerchantStorageScheme,
|
||||||
) -> CustomResult<domain::Address, errors::StorageError> {
|
) -> CustomResult<domain::Address, errors::StorageError> {
|
||||||
match self
|
let updated_addr = self
|
||||||
.addresses
|
.addresses
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
@ -698,7 +699,8 @@ impl AddressInterface for MockDb {
|
|||||||
AddressUpdateInternal::from(address_update).create_address(a.clone());
|
AddressUpdateInternal::from(address_update).create_address(a.clone());
|
||||||
*a = address_updated.clone();
|
*a = address_updated.clone();
|
||||||
address_updated
|
address_updated
|
||||||
}) {
|
});
|
||||||
|
match updated_addr {
|
||||||
Some(address_updated) => address_updated
|
Some(address_updated) => address_updated
|
||||||
.convert(key_store.key.get_inner())
|
.convert(key_store.key.get_inner())
|
||||||
.await
|
.await
|
||||||
@ -757,7 +759,7 @@ impl AddressInterface for MockDb {
|
|||||||
address_update: storage_types::AddressUpdate,
|
address_update: storage_types::AddressUpdate,
|
||||||
key_store: &domain::MerchantKeyStore,
|
key_store: &domain::MerchantKeyStore,
|
||||||
) -> CustomResult<Vec<domain::Address>, errors::StorageError> {
|
) -> CustomResult<Vec<domain::Address>, errors::StorageError> {
|
||||||
match self
|
let updated_addr = self
|
||||||
.addresses
|
.addresses
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
@ -771,7 +773,8 @@ impl AddressInterface for MockDb {
|
|||||||
AddressUpdateInternal::from(address_update).create_address(a.clone());
|
AddressUpdateInternal::from(address_update).create_address(a.clone());
|
||||||
*a = address_updated.clone();
|
*a = address_updated.clone();
|
||||||
address_updated
|
address_updated
|
||||||
}) {
|
});
|
||||||
|
match updated_addr {
|
||||||
Some(address) => {
|
Some(address) => {
|
||||||
let address: domain::Address = address
|
let address: domain::Address = address
|
||||||
.convert(key_store.key.get_inner())
|
.convert(key_store.key.get_inner())
|
||||||
|
|||||||
@ -691,7 +691,7 @@ impl MerchantConnectorAccountInterface for MockDb {
|
|||||||
merchant_connector_account: storage::MerchantConnectorAccountUpdateInternal,
|
merchant_connector_account: storage::MerchantConnectorAccountUpdateInternal,
|
||||||
key_store: &domain::MerchantKeyStore,
|
key_store: &domain::MerchantKeyStore,
|
||||||
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
|
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
|
||||||
match self
|
let mca_update_res = self
|
||||||
.merchant_connector_accounts
|
.merchant_connector_accounts
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
@ -709,8 +709,9 @@ impl MerchantConnectorAccountInterface for MockDb {
|
|||||||
.await
|
.await
|
||||||
.change_context(errors::StorageError::DecryptionError)
|
.change_context(errors::StorageError::DecryptionError)
|
||||||
})
|
})
|
||||||
.await
|
.await;
|
||||||
{
|
|
||||||
|
match mca_update_res {
|
||||||
Some(result) => result,
|
Some(result) => result,
|
||||||
None => {
|
None => {
|
||||||
return Err(errors::StorageError::ValueNotFound(
|
return Err(errors::StorageError::ValueNotFound(
|
||||||
|
|||||||
@ -212,7 +212,7 @@ impl PaymentMethodInterface for MockDb {
|
|||||||
payment_method: storage::PaymentMethod,
|
payment_method: storage::PaymentMethod,
|
||||||
payment_method_update: storage::PaymentMethodUpdate,
|
payment_method_update: storage::PaymentMethodUpdate,
|
||||||
) -> CustomResult<storage::PaymentMethod, errors::StorageError> {
|
) -> CustomResult<storage::PaymentMethod, errors::StorageError> {
|
||||||
match self
|
let pm_update_res = self
|
||||||
.payment_methods
|
.payment_methods
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
@ -224,7 +224,9 @@ impl PaymentMethodInterface for MockDb {
|
|||||||
.create_payment_method(pm.clone());
|
.create_payment_method(pm.clone());
|
||||||
*pm = payment_method_updated.clone();
|
*pm = payment_method_updated.clone();
|
||||||
payment_method_updated
|
payment_method_updated
|
||||||
}) {
|
});
|
||||||
|
|
||||||
|
match pm_update_res {
|
||||||
Some(result) => Ok(result),
|
Some(result) => Ok(result),
|
||||||
None => Err(errors::StorageError::ValueNotFound(
|
None => Err(errors::StorageError::ValueNotFound(
|
||||||
"cannot find payment method to update".to_string(),
|
"cannot find payment method to update".to_string(),
|
||||||
|
|||||||
@ -1083,7 +1083,7 @@ where
|
|||||||
let start_instant = Instant::now();
|
let start_instant = Instant::now();
|
||||||
logger::info!(tag = ?Tag::BeginRequest, payload = ?payload);
|
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(
|
server_wrap_util(
|
||||||
&flow,
|
&flow,
|
||||||
state.clone(),
|
state.clone(),
|
||||||
@ -1099,7 +1099,9 @@ where
|
|||||||
.map(|response| {
|
.map(|response| {
|
||||||
logger::info!(api_response =? response);
|
logger::info!(api_response =? response);
|
||||||
response
|
response
|
||||||
}) {
|
});
|
||||||
|
|
||||||
|
let res = match server_wrap_util_res {
|
||||||
Ok(ApplicationResponse::Json(response)) => match serde_json::to_string(&response) {
|
Ok(ApplicationResponse::Json(response)) => match serde_json::to_string(&response) {
|
||||||
Ok(res) => http_response_json(res),
|
Ok(res) => http_response_json(res),
|
||||||
Err(_) => http_response_err(
|
Err(_) => http_response_err(
|
||||||
|
|||||||
@ -109,7 +109,7 @@ where
|
|||||||
{
|
{
|
||||||
Ok(x) => Ok(x),
|
Ok(x) => Ok(x),
|
||||||
Err(mut err) => {
|
Err(mut err) => {
|
||||||
match state
|
let update_res = state
|
||||||
.process_tracker_update_process_status_by_ids(
|
.process_tracker_update_process_status_by_ids(
|
||||||
pt_batch.trackers.iter().map(|process| process.id.clone()).collect(),
|
pt_batch.trackers.iter().map(|process| process.id.clone()).collect(),
|
||||||
storage::ProcessTrackerUpdate::StatusUpdate {
|
storage::ProcessTrackerUpdate::StatusUpdate {
|
||||||
@ -123,7 +123,9 @@ where
|
|||||||
}, |count| {
|
}, |count| {
|
||||||
logger::debug!("Updated status of {count} processes");
|
logger::debug!("Updated status of {count} processes");
|
||||||
Ok(())
|
Ok(())
|
||||||
}) {
|
});
|
||||||
|
|
||||||
|
match update_res {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(inner_err) => {
|
Err(inner_err) => {
|
||||||
err.extend_one(inner_err);
|
err.extend_one(inner_err);
|
||||||
|
|||||||
@ -56,7 +56,6 @@ where
|
|||||||
|
|
||||||
// Open the file in write mode or create it if it doesn't exist
|
// Open the file in write mode or create it if it doesn't exist
|
||||||
let mut file = std::fs::OpenOptions::new()
|
let mut file = std::fs::OpenOptions::new()
|
||||||
.write(true)
|
|
||||||
.append(true)
|
.append(true)
|
||||||
.create(true)
|
.create(true)
|
||||||
.open(file_path)?;
|
.open(file_path)?;
|
||||||
|
|||||||
Reference in New Issue
Block a user