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.81.0 clippy lints (#5832)

Chethan Rao933cef425fed
diff --git a/crates/drainer/src/health_check.rs b/crates/drainer/src/health_check.rs
index 1051410899..946489513b 100644
--- a/crates/drainer/src/health_check.rs
+++ b/crates/drainer/src/health_check.rs
@@ -170,7 +170,7 @@ impl HealthCheckInterface for Store {
logger::debug!("Redis set_key was successful");
redis_conn
- .get_key("test_key")
+ .get_key::<()>("test_key")
.await
.change_context(HealthCheckRedisError::GetFailed)?;
diff --git a/crates/router/src/connector/globalpay.rs b/crates/router/src/connector/globalpay.rs
index 7d5553bb25..2707ef4b6f 100644
--- a/crates/router/src/connector/globalpay.rs
+++ b/crates/router/src/connector/globalpay.rs
@@ -1017,11 +1017,12 @@ impl api::IncomingWebhook for Globalpay {
&self,
request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
- let details = std::str::from_utf8(request.body)
- .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
- Ok(Box::new(serde_json::from_str(details).change_context(
- errors::ConnectorError::WebhookResourceObjectNotFound,
- )?))
+ Ok(Box::new(
+ request
+ .body
+ .parse_struct::<GlobalpayPaymentsResponse>("GlobalpayPaymentsResponse")
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?,
+ ))
}
}
diff --git a/crates/router/src/core/health_check.rs b/crates/router/src/core/health_check.rs
index 6092ac8bbb..83faee677d 100644
--- a/crates/router/src/core/health_check.rs
+++ b/crates/router/src/core/health_check.rs
@@ -52,7 +52,7 @@ impl HealthCheckInterface for app::SessionState {
logger::debug!("Redis set_key was successful");
redis_conn
- .get_key("test_key")
+ .get_key::<()>("test_key")
.await
.change_context(errors::HealthCheckRedisError::GetFailed)?;
diff --git a/crates/router/src/core/payment_methods/surcharge_decision_configs.rs b/crates/router/src/core/payment_methods/surcharge_decision_configs.rs
index 477f025c78..4ea4b60d67 100644
--- a/crates/router/src/core/payment_methods/surcharge_decision_configs.rs
+++ b/crates/router/src/core/payment_methods/surcharge_decision_configs.rs
@@ -88,11 +88,10 @@ impl SurchargeSource {
)
})
.transpose()?
- .map(|surcharge_details| {
+ .inspect(|surcharge_details| {
let (surcharge_metadata, surcharge_key) = surcharge_metadata_and_key;
surcharge_metadata
.insert_surcharge_details(surcharge_key, surcharge_details.clone());
- surcharge_details
}))
}
Self::Predetermined(request_surcharge_details) => Ok(Some(
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 29566b6b9a..9c83c5f2fe 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -145,7 +145,7 @@ where
.to_validate_request()?
.validate_request(&req, &merchant_account)?;
- tracing::Span::current().record("payment_id", &format!("{}", validate_result.payment_id));
+ tracing::Span::current().record("payment_id", format!("{}", validate_result.payment_id));
let operations::GetTrackerResponse {
operation,
diff --git a/crates/router_env/tests/env.rs b/crates/router_env/tests/env.rs
index e4609a4883..cff2ae45f1 100644
--- a/crates/router_env/tests/env.rs
+++ b/crates/router_env/tests/env.rs
@@ -25,7 +25,7 @@ async fn basic() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
#[cfg(feature = "vergen")]
#[tokio::test]
-async fn env_macro() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
+async fn env_macro() {
println!("version : {:?}", env::version!());
println!("build : {:?}", env::build!());
println!("commit : {:?}", env::commit!());
@@ -35,6 +35,4 @@ async fn env_macro() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
assert!(!env::build!().is_empty());
assert!(!env::commit!().is_empty());
// assert!(env::platform!().len() > 0);
-
- Ok(())
}
diff --git a/crates/storage_impl/src/redis/kv_store.rs b/crates/storage_impl/src/redis/kv_store.rs
index 8511702baa..74b1526fe8 100644
--- a/crates/storage_impl/src/redis/kv_store.rs
+++ b/crates/storage_impl/src/redis/kv_store.rs
@@ -259,12 +259,11 @@ where
result
.await
- .map(|result| {
+ .inspect(|_| {
logger::debug!(kv_operation= %operation, status="success");
let keyvalue = router_env::opentelemetry::KeyValue::new("operation", operation.clone());
metrics::KV_OPERATION_SUCCESSFUL.add(&metrics::CONTEXT, 1, &[keyvalue]);
- result
})
.inspect_err(|err| {
logger::error!(kv_operation = %operation, status="error", error = ?err);
diff --git a/crates/storage_impl/src/redis/pub_sub.rs b/crates/storage_impl/src/redis/pub_sub.rs
index 8f24b62fca..7d7557a7f5 100644
--- a/crates/storage_impl/src/redis/pub_sub.rs
+++ b/crates/storage_impl/src/redis/pub_sub.rs
@@ -30,7 +30,7 @@ impl PubSubInterface for std::sync::Arc<redis_interface::RedisConnectionPool> {
self.subscriber.manage_subscriptions();
self.subscriber
- .subscribe(channel)
+ .subscribe::<(), &str>(channel)
.await
.change_context(redis_errors::RedisError::SubscribeError)?;