diff --git a/Cargo.toml b/Cargo.toml index 97939c5633..acd8edf0b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,6 @@ fn_params_excessive_bools = "warn" index_refutable_slice = "warn" indexing_slicing = "warn" large_futures = "warn" -match_on_vec_items = "warn" missing_panics_doc = "warn" mod_module_files = "warn" out_of_bounds_indexing = "warn" diff --git a/crates/analytics/src/clickhouse.rs b/crates/analytics/src/clickhouse.rs index f58df9bedf..383c18e6f0 100644 --- a/crates/analytics/src/clickhouse.rs +++ b/crates/analytics/src/clickhouse.rs @@ -502,7 +502,7 @@ where }; format!( "{query}{}", - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::Sum { field, alias } => { @@ -522,7 +522,7 @@ where }; format!( "{query}{}", - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::Min { field, alias } => { @@ -531,7 +531,7 @@ where field .to_sql(table_engine) .attach_printable("Failed to min aggregate")?, - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::Max { field, alias } => { @@ -540,7 +540,7 @@ where field .to_sql(table_engine) .attach_printable("Failed to max aggregate")?, - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::Percentile { @@ -554,7 +554,7 @@ where field .to_sql(table_engine) .attach_printable("Failed to percentile aggregate")?, - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::DistinctCount { field, alias } => { @@ -563,7 +563,7 @@ where field .to_sql(table_engine) .attach_printable("Failed to percentile aggregate")?, - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } }) @@ -599,7 +599,7 @@ where order ) ), - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::RowNumber { @@ -622,7 +622,7 @@ where order ) ), - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } }) diff --git a/crates/analytics/src/lib.rs b/crates/analytics/src/lib.rs index e8a01c27ca..2df457dde2 100644 --- a/crates/analytics/src/lib.rs +++ b/crates/analytics/src/lib.rs @@ -107,7 +107,7 @@ impl std::fmt::Display for AnalyticsProvider { Self::CombinedSqlx(_, _) => "CombinedSqlx", }; - write!(f, "{}", analytics_provider) + write!(f, "{analytics_provider}") } } diff --git a/crates/analytics/src/opensearch.rs b/crates/analytics/src/opensearch.rs index 20be0116d9..47714e47ea 100644 --- a/crates/analytics/src/opensearch.rs +++ b/crates/analytics/src/opensearch.rs @@ -143,7 +143,7 @@ impl ErrorSwitch for OpenSearchError { Self::ResponseNotOK(response) => ApiErrorResponse::InternalServerError(ApiError::new( "IR", 1, - format!("Something went wrong {}", response), + format!("Something went wrong {response}"), None, )), Self::ResponseError => ApiErrorResponse::InternalServerError(ApiError::new( diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs index f19185b345..5ed76cc493 100644 --- a/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs +++ b/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs @@ -77,7 +77,7 @@ where .switch()?; outer_query_builder - .add_select_column(format!("({}) AS total", inner_query_string)) + .add_select_column(format!("({inner_query_string}) AS total")) .switch()?; outer_query_builder diff --git a/crates/analytics/src/query.rs b/crates/analytics/src/query.rs index 50d16c68e6..5b3059cab7 100644 --- a/crates/analytics/src/query.rs +++ b/crates/analytics/src/query.rs @@ -737,7 +737,7 @@ where .change_context(QueryBuildingError::SqlSerializeError) .attach_printable("Error serializing order direction")?; - self.order_by.push(format!("{} {}", column_sql, order_sql)); + self.order_by.push(format!("{column_sql} {order_sql}")); Ok(()) } @@ -892,7 +892,7 @@ where } if let Some(limit_by) = &self.limit_by { - query.push_str(&format!(" {}", limit_by)); + query.push_str(&format!(" {limit_by}")); } if !self.outer_select.is_empty() { diff --git a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_error_message.rs b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_error_message.rs index c6579005fa..95be97e7af 100644 --- a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_error_message.rs +++ b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_error_message.rs @@ -77,7 +77,7 @@ where .switch()?; outer_query_builder - .add_select_column(format!("({}) AS total", inner_query_string)) + .add_select_column(format!("({inner_query_string}) AS total")) .switch()?; outer_query_builder diff --git a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_reason.rs b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_reason.rs index f7a2e11676..6e7f5ecb18 100644 --- a/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_reason.rs +++ b/crates/analytics/src/refunds/metrics/sessionized_metrics/refund_reason.rs @@ -76,7 +76,7 @@ where .switch()?; outer_query_builder - .add_select_column(format!("({}) AS total", inner_query_string)) + .add_select_column(format!("({inner_query_string}) AS total")) .switch()?; outer_query_builder diff --git a/crates/analytics/src/sqlx.rs b/crates/analytics/src/sqlx.rs index 53b9cc10e1..10f039fcc7 100644 --- a/crates/analytics/src/sqlx.rs +++ b/crates/analytics/src/sqlx.rs @@ -1434,7 +1434,7 @@ where Self::Count { field: _, alias } => { format!( "count(*){}", - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::Sum { field, alias } => { @@ -1443,7 +1443,7 @@ where field .to_sql(table_engine) .attach_printable("Failed to sum aggregate")?, - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::Min { field, alias } => { @@ -1452,7 +1452,7 @@ where field .to_sql(table_engine) .attach_printable("Failed to min aggregate")?, - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::Max { field, alias } => { @@ -1461,7 +1461,7 @@ where field .to_sql(table_engine) .attach_printable("Failed to max aggregate")?, - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::Percentile { @@ -1475,7 +1475,7 @@ where field .to_sql(table_engine) .attach_printable("Failed to percentile aggregate")?, - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::DistinctCount { field, alias } => { @@ -1484,7 +1484,7 @@ where field .to_sql(table_engine) .attach_printable("Failed to distinct count aggregate")?, - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } }) @@ -1520,7 +1520,7 @@ where order ) ), - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::RowNumber { @@ -1543,7 +1543,7 @@ where order ) ), - alias.map_or_else(|| "".to_owned(), |alias| format!(" as {}", alias)) + alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } }) diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index 00fccd4ed4..f264c94370 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -728,8 +728,7 @@ impl WebhookDetails { for status in statuses { if !valid_statuses.contains(status) { return Err(format!( - "Invalid {} webhook status provided: {:?}", - status_type_name, status + "Invalid {status_type_name} webhook status provided: {status:?}" )); } } diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs index 57f8b52355..df1827053a 100644 --- a/crates/api_models/src/enums.rs +++ b/crates/api_models/src/enums.rs @@ -114,7 +114,7 @@ impl TryFrom for PayoutConnectors { Connector::Paypal => Ok(Self::Paypal), Connector::Stripe => Ok(Self::Stripe), Connector::Wise => Ok(Self::Wise), - _ => Err(format!("Invalid payout connector {}", value)), + _ => Err(format!("Invalid payout connector {value}")), } } } diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index b3e76e3729..6a8f61484d 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -352,8 +352,7 @@ where .map_err(|err| { let err_msg = format!("{err:?}"); de::Error::custom(format_args!( - "Failed to deserialize PaymentsMandateReference `{}`", - err_msg + "Failed to deserialize PaymentsMandateReference `{err_msg}`", )) })?; @@ -371,8 +370,7 @@ where .map_err(|err| { let err_msg = format!("{err:?}"); de::Error::custom(format_args!( - "Failed to deserialize CommonMandateReference `{}`", - err_msg + "Failed to deserialize CommonMandateReference `{err_msg}`", )) })? .flatten(); @@ -2109,7 +2107,7 @@ pub struct CustomerPaymentMethodResponseItem { #[schema(value_type = String, example = "12345_pm_01926c58bc6e77c09e809964e72af8c8")] pub id: id_type::GlobalPaymentMethodId, - /// Temporary Token for payment method in vault which gets refreshed for every payment + /// Temporary Token for payment method in vault which gets refreshed for every payment #[schema(example = "7ebf443f-a050-4067-84e5-e6f6d4800aef")] pub payment_token: String, diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs index a8f7315be4..a900d84150 100644 --- a/crates/api_models/src/routing.rs +++ b/crates/api_models/src/routing.rs @@ -224,7 +224,7 @@ impl std::fmt::Display for RoutableConnectorChoice { if let Some(mca_id) = &self.merchant_connector_id { return write!(f, "{}:{}", base, mca_id.get_string_repr()); } - write!(f, "{}", base) + write!(f, "{base}") } } diff --git a/crates/common_enums/src/enums/ui.rs b/crates/common_enums/src/enums/ui.rs index eaa63e89e3..4811cffa4c 100644 --- a/crates/common_enums/src/enums/ui.rs +++ b/crates/common_enums/src/enums/ui.rs @@ -187,10 +187,10 @@ impl Serialize for ElementSize { match self { Self::Variants(variant) => serializer.serialize_str(variant.to_string().as_str()), Self::Pixels(pixel_count) => { - serializer.serialize_str(format!("{}px", pixel_count).as_str()) + serializer.serialize_str(format!("{pixel_count}px").as_str()) } Self::Percentage(pixel_count) => { - serializer.serialize_str(format!("{}%", pixel_count).as_str()) + serializer.serialize_str(format!("{pixel_count}%").as_str()) } } } diff --git a/crates/common_utils/src/link_utils.rs b/crates/common_utils/src/link_utils.rs index 89a52f4479..f91a26cdae 100644 --- a/crates/common_utils/src/link_utils.rs +++ b/crates/common_utils/src/link_utils.rs @@ -283,8 +283,7 @@ mod domain_tests { for domain in valid_domains { assert!( validate_strict_domain(domain), - "Could not validate strict domain: {}", - domain + "Could not validate strict domain: {domain}", ); } @@ -299,8 +298,7 @@ mod domain_tests { for domain in invalid_domains { assert!( !validate_strict_domain(domain), - "Could not validate invalid strict domain: {}", - domain + "Could not validate invalid strict domain: {domain}", ); } } @@ -328,8 +326,7 @@ mod domain_tests { for domain in valid_domains { assert!( validate_wildcard_domain(domain), - "Could not validate wildcard domain: {}", - domain + "Could not validate wildcard domain: {domain}", ); } @@ -349,8 +346,7 @@ mod domain_tests { for domain in invalid_domains { assert!( !validate_wildcard_domain(domain), - "Could not validate invalid wildcard domain: {}", - domain + "Could not validate invalid wildcard domain: {domain}", ); } } diff --git a/crates/common_utils/src/new_type.rs b/crates/common_utils/src/new_type.rs index 96d558bfa3..1bf673ecc4 100644 --- a/crates/common_utils/src/new_type.rs +++ b/crates/common_utils/src/new_type.rs @@ -163,7 +163,7 @@ impl From for MaskedUpiVpaId { .take(unmasked_char_count) .collect::() + &"*".repeat(user_identifier.len() - unmasked_char_count); - format!("{}@{}", masked_user_identifier, bank_or_psp) + format!("{masked_user_identifier}@{bank_or_psp}") } else { let masked_value = apply_mask(src.as_ref(), unmasked_char_count, 8); masked_value @@ -191,7 +191,7 @@ impl From for MaskedEmail { .take(unmasked_char_count) .collect::() + &"*".repeat(user_identifier.len() - unmasked_char_count); - format!("{}@{}", masked_user_identifier, domain) + format!("{masked_user_identifier}@{domain}") } else { let masked_value = apply_mask(src.as_ref(), unmasked_char_count, 8); masked_value diff --git a/crates/common_utils/src/pii.rs b/crates/common_utils/src/pii.rs index 5fd0e8078a..b1805b3b17 100644 --- a/crates/common_utils/src/pii.rs +++ b/crates/common_utils/src/pii.rs @@ -338,7 +338,7 @@ where } if let Some(segments) = segments.first() { - write!(f, "{}.**.**.**", segments) + write!(f, "{segments}.**.**.**") } else { #[cfg(feature = "logs")] logger::error!("Invalid IP address: {val_str}"); diff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rs index 4422b3e3d5..cb7f61ca7a 100644 --- a/crates/common_utils/src/types.rs +++ b/crates/common_utils/src/types.rs @@ -63,8 +63,8 @@ pub struct Percentage { fn get_invalid_percentage_error_message(precision: u8) -> String { format!( - "value should be a float between 0 to 100 and precise to only upto {} decimal digits", - precision + "value should be a float between 0 to 100 and precise to only upto {precision} decimal digits", + ) } @@ -102,8 +102,7 @@ impl Percentage { amount: MinorUnit::new(amount), })) .attach_printable(format!( - "Cannot calculate percentage for amount greater than {}", - max_amount + "Cannot calculate percentage for amount greater than {max_amount}", )) } else { let percentage_f64 = f64::from(self.percentage); @@ -169,7 +168,7 @@ impl<'de, const PRECISION: u8> Visitor<'de> for PercentageVisitor { let string_value = value.to_string(); Ok(Percentage::from_string(string_value.clone()).map_err(|_| { serde::de::Error::invalid_value( - serde::de::Unexpected::Other(&format!("percentage value {}", string_value)), + serde::de::Unexpected::Other(&format!("percentage value {string_value}")), &&*get_invalid_percentage_error_message(PRECISION), ) })?) @@ -1289,8 +1288,7 @@ impl ConnectorTransactionId { message: "processor_transaction_data is empty for HashedData variant".to_string(), }) .attach_printable(format!( - "processor_transaction_data is empty for connector_transaction_id {}", - id + "processor_transaction_data is empty for connector_transaction_id {id}", ))), } } @@ -1308,7 +1306,7 @@ impl From for ConnectorTransactionId { hasher.update(src.as_bytes()); hasher.finalize_xof().fill(&mut output); let hash = hex::encode(output); - Self::HashedData(format!("hs_hash_{}", hash)) + Self::HashedData(format!("hs_hash_{hash}")) // Default } else { Self::TxnId(src) diff --git a/crates/common_utils/src/validation.rs b/crates/common_utils/src/validation.rs index 0edb927233..2bcad17882 100644 --- a/crates/common_utils/src/validation.rs +++ b/crates/common_utils/src/validation.rs @@ -71,8 +71,8 @@ pub fn validate_domain_against_allowed_domains( .map(|glob| glob.compile_matcher().is_match(domain)) .map_err(|err| { let err_msg = format!( - "Invalid glob pattern for configured allowed_domain [{:?}]! - {:?}", - allowed_domain, err + "Invalid glob pattern for configured allowed_domain [{allowed_domain:?}]! - {err:?}", + ); #[cfg(feature = "logs")] logger::error!(err_msg); diff --git a/crates/common_utils/tests/percentage.rs b/crates/common_utils/tests/percentage.rs index 0858c98fd6..fbb350820e 100644 --- a/crates/common_utils/tests/percentage.rs +++ b/crates/common_utils/tests/percentage.rs @@ -107,17 +107,16 @@ fn deserialization_test_ok() -> Result<(), Box>(&json_string); assert!(percentage.is_ok()); if let Ok(percentage) = percentage { assert_eq!( percentage.get_percentage(), - format!("{}.{}", integer, decimal) + format!("{integer}.{decimal}") .parse::() .unwrap_or_default() ) diff --git a/crates/currency_conversion/src/conversion.rs b/crates/currency_conversion/src/conversion.rs index aa3122d803..479b6986a7 100644 --- a/crates/currency_conversion/src/conversion.rs +++ b/crates/currency_conversion/src/conversion.rs @@ -49,10 +49,7 @@ mod tests { let sample_rate = ExchangeRates::new(base_currency, conversion); let res = convert(&sample_rate, convert_from, convert_to, amount).expect("converted_currency"); - println!( - "The conversion from {} {} to {} is {:?}", - amount, convert_from, convert_to, res - ); + println!("The conversion from {amount} {convert_from} to {convert_to} is {res:?}"); } #[test] @@ -71,10 +68,7 @@ mod tests { let sample_rate = ExchangeRates::new(base_currency, conversion); let res = convert(&sample_rate, convert_from, convert_to, amount).expect("converted_currency"); - println!( - "The conversion from {} {} to {} is {:?}", - amount, convert_from, convert_to, res - ); + println!("The conversion from {amount} {convert_from} to {convert_to} is {res:?}"); } #[test] @@ -93,9 +87,6 @@ mod tests { let sample_rate = ExchangeRates::new(base_currency, conversion); let res = convert(&sample_rate, convert_from, convert_to, amount).expect("converted_currency"); - println!( - "The conversion from {} {} to {} is {:?}", - amount, convert_from, convert_to, res - ); + println!("The conversion from {amount} {convert_from} to {convert_to} is {res:?}"); } } diff --git a/crates/diesel_models/src/query/payment_attempt.rs b/crates/diesel_models/src/query/payment_attempt.rs index 1226f44221..a7baf75f06 100644 --- a/crates/diesel_models/src/query/payment_attempt.rs +++ b/crates/diesel_models/src/query/payment_attempt.rs @@ -199,10 +199,7 @@ impl PaymentAttempt { .get_txn_id(txn_data.as_ref()) .change_context(DatabaseError::Others) .attach_printable_lazy(|| { - format!( - "Failed to retrieve txn_id for ({:?}, {:?})", - txn_id, txn_data - ) + format!("Failed to retrieve txn_id for ({txn_id:?}, {txn_data:?})") })?; generics::generic_find_one::<::Table, _, _>( conn, @@ -226,10 +223,7 @@ impl PaymentAttempt { .get_txn_id(txn_data.as_ref()) .change_context(DatabaseError::Others) .attach_printable_lazy(|| { - format!( - "Failed to retrieve txn_id for ({:?}, {:?})", - txn_id, txn_data - ) + format!("Failed to retrieve txn_id for ({txn_id:?}, {txn_data:?})") })?; generics::generic_find_one::<::Table, _, _>( conn, diff --git a/crates/diesel_models/src/refund.rs b/crates/diesel_models/src/refund.rs index 33f48284cf..f7cb1c595e 100644 --- a/crates/diesel_models/src/refund.rs +++ b/crates/diesel_models/src/refund.rs @@ -730,8 +730,7 @@ impl RefundUpdate { Self::ErrorUpdate { refund_status: Some(storage_enums::RefundStatus::ManualReview), refund_error_message: Some(format!( - "Integrity Check Failed! as data mismatched for fields {}", - integrity_check_failed_fields + "Integrity Check Failed! as data mismatched for fields {integrity_check_failed_fields}" )), refund_error_code: Some("IE".to_string()), updated_by: storage_scheme.to_string(), diff --git a/crates/euclid_macros/src/inner/knowledge.rs b/crates/euclid_macros/src/inner/knowledge.rs index baef55338f..49d645be72 100644 --- a/crates/euclid_macros/src/inner/knowledge.rs +++ b/crates/euclid_macros/src/inner/knowledge.rs @@ -37,7 +37,7 @@ impl Display for Comparison { Self::LessThanEqual => "<= ", Self::GreaterThan => "> ", }; - write!(f, "{}", symbol) + write!(f, "{symbol}") } } @@ -74,7 +74,7 @@ impl ValueType { Self::Any => format!("{key}(any)"), Self::EnumVariant(s) => format!("{key}({s})"), Self::Number { number, comparison } => { - format!("{}({}{})", key, comparison, number) + format!("{key}({comparison}{number})") } } } diff --git a/crates/external_services/src/aws_kms/core.rs b/crates/external_services/src/aws_kms/core.rs index 537e63655b..d8af84931a 100644 --- a/crates/external_services/src/aws_kms/core.rs +++ b/crates/external_services/src/aws_kms/core.rs @@ -186,7 +186,7 @@ mod tests { .await .expect("aws kms encryption failed"); - println!("{}", kms_encrypted_fingerprint); + println!("{kms_encrypted_fingerprint}"); } #[tokio::test] @@ -208,6 +208,6 @@ mod tests { .await .expect("aws kms decryption failed"); - println!("{}", kms_encrypted_fingerprint); + println!("{kms_encrypted_fingerprint}"); } } diff --git a/crates/external_services/src/grpc_client/dynamic_routing.rs b/crates/external_services/src/grpc_client/dynamic_routing.rs index 67069b9fe8..a9ee7852d3 100644 --- a/crates/external_services/src/grpc_client/dynamic_routing.rs +++ b/crates/external_services/src/grpc_client/dynamic_routing.rs @@ -80,7 +80,7 @@ impl DynamicRoutingClientConfig { ) -> Result> { let (success_rate_client, contract_based_client, elimination_based_client) = match self { Self::Enabled { host, port, .. } => { - let uri = format!("http://{}:{}", host, port).parse::()?; + let uri = format!("http://{host}:{port}").parse::()?; logger::info!("Connection established with dynamic routing gRPC Server"); ( Some(SuccessRateCalculatorClient::with_origin( diff --git a/crates/external_services/src/http_client/client.rs b/crates/external_services/src/http_client/client.rs index 46fe1bf7ac..633634b653 100644 --- a/crates/external_services/src/http_client/client.rs +++ b/crates/external_services/src/http_client/client.rs @@ -126,7 +126,7 @@ pub fn create_identity_from_certificate_and_key( let certificate_key = String::from_utf8(decoded_certificate_key) .change_context(HttpClientError::CertificateDecodeFailed)?; - let key_chain = format!("{}{}", certificate_key, certificate); + let key_chain = format!("{certificate_key}{certificate}"); reqwest::Identity::from_pem(key_chain.as_bytes()) .change_context(HttpClientError::CertificateDecodeFailed) } diff --git a/crates/hsdev/src/main.rs b/crates/hsdev/src/main.rs index d8c68fea42..2c368339c8 100644 --- a/crates/hsdev/src/main.rs +++ b/crates/hsdev/src/main.rs @@ -25,14 +25,14 @@ fn main() { let toml_contents = match std::fs::read_to_string(toml_file) { Ok(contents) => contents, Err(e) => { - eprintln!("Error reading TOML file: {}", e); + eprintln!("Error reading TOML file: {e}"); return; } }; let toml_data: Value = match toml_contents.parse() { Ok(data) => data, Err(e) => { - eprintln!("Error parsing TOML file: {}", e); + eprintln!("Error parsing TOML file: {e}"); return; } }; @@ -42,14 +42,14 @@ fn main() { let input = match input_file::InputData::read(table) { Ok(data) => data, Err(e) => { - eprintln!("Error loading TOML file: {}", e); + eprintln!("Error loading TOML file: {e}"); return; } }; let db_url = input.postgres_url(); - println!("Attempting to connect to {}", db_url); + println!("Attempting to connect to {db_url}"); let mut conn = match PgConnection::establish(&db_url) { Ok(value) => value, diff --git a/crates/hyperswitch_connectors/src/connectors/adyen.rs b/crates/hyperswitch_connectors/src/connectors/adyen.rs index f53615d6bb..b0c32ad5f9 100644 --- a/crates/hyperswitch_connectors/src/connectors/adyen.rs +++ b/crates/hyperswitch_connectors/src/connectors/adyen.rs @@ -462,7 +462,7 @@ impl ConnectorIntegration fo &req.connector_meta_data, )?; Ok(format!( - "{}{}/payments/{}/captures", - endpoint, ADYEN_API_VERSION, id + "{endpoint}{ADYEN_API_VERSION}/payments/{id}/captures", )) } fn get_request_body( @@ -729,10 +728,7 @@ impl ConnectorIntegration for Ady req.test_mode, &req.connector_meta_data, )?; - Ok(format!( - "{}{}/payments/details", - endpoint, ADYEN_API_VERSION - )) + Ok(format!("{endpoint}{ADYEN_API_VERSION}/payments/details")) } fn build_request( @@ -849,7 +845,7 @@ impl ConnectorIntegration for Ad &req.connector_meta_data, )?; Ok(format!( - "{}{}/payments/{}/cancels", - endpoint, ADYEN_API_VERSION, id + "{endpoint}{ADYEN_API_VERSION}/payments/{id}/cancels", )) } @@ -1183,8 +1177,7 @@ impl ConnectorIntegration for Adyen &req.connector_meta_data, )?; Ok(format!( - "{}pal/servlet/Payout/{}/declineThirdParty", - endpoint, ADYEN_API_VERSION + "{endpoint}pal/servlet/Payout/{ADYEN_API_VERSION}/declineThirdParty", )) } @@ -1281,8 +1274,7 @@ impl ConnectorIntegration for Adyen &req.connector_meta_data, )?; Ok(format!( - "{}pal/servlet/Payout/{}/storeDetailAndSubmitThirdParty", - endpoint, ADYEN_API_VERSION + "{endpoint}pal/servlet/Payout/{ADYEN_API_VERSION}/storeDetailAndSubmitThirdParty", )) } @@ -1379,7 +1371,7 @@ impl ConnectorIntegration for A req.test_mode, &req.connector_meta_data, )?; - Ok(format!("{}{}/payments", endpoint, ADYEN_API_VERSION)) + Ok(format!("{endpoint}{ADYEN_API_VERSION}/payments")) } fn get_headers( @@ -1625,8 +1617,7 @@ impl ConnectorIntegration for Adyen { &req.connector_meta_data, )?; Ok(format!( - "{}{}/payments/{}/refunds", - endpoint, ADYEN_API_VERSION, connector_payment_id + "{endpoint}{ADYEN_API_VERSION}/payments/{connector_payment_id}/refunds", )) } @@ -1977,8 +1968,7 @@ impl ConnectorIntegration "#, - transaction_data ); Ok(body.as_bytes().to_vec()) diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs index 5c1d70317a..472fd85d5d 100644 --- a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs @@ -2729,18 +2729,16 @@ pub fn get_error_reason( ) -> Option { match (error_info, detailed_error_info, avs_error_info) { (Some(message), Some(details), Some(avs_message)) => Some(format!( - "{}, detailed_error_information: {}, avs_message: {}", - message, details, avs_message - )), - (Some(message), Some(details), None) => Some(format!( - "{}, detailed_error_information: {}", - message, details + "{message}, detailed_error_information: {details}, avs_message: {avs_message}", )), + (Some(message), Some(details), None) => { + Some(format!("{message}, detailed_error_information: {details}")) + } (Some(message), None, Some(avs_message)) => { - Some(format!("{}, avs_message: {}", message, avs_message)) + Some(format!("{message}, avs_message: {avs_message}")) } (None, Some(details), Some(avs_message)) => { - Some(format!("{}, avs_message: {}", details, avs_message)) + Some(format!("{details}, avs_message: {avs_message}")) } (Some(message), None, None) => Some(message), (None, Some(details), None) => Some(details), diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs index 14425bb118..d66782b093 100644 --- a/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs @@ -1596,18 +1596,16 @@ pub fn get_error_reason( ) -> Option { match (error_info, detailed_error_info, avs_error_info) { (Some(message), Some(details), Some(avs_message)) => Some(format!( - "{}, detailed_error_information: {}, avs_message: {}", - message, details, avs_message - )), - (Some(message), Some(details), None) => Some(format!( - "{}, detailed_error_information: {}", - message, details + "{message}, detailed_error_information: {details}, avs_message: {avs_message}", )), + (Some(message), Some(details), None) => { + Some(format!("{message}, detailed_error_information: {details}")) + } (Some(message), None, Some(avs_message)) => { - Some(format!("{}, avs_message: {}", message, avs_message)) + Some(format!("{message}, avs_message: {avs_message}")) } (None, Some(details), Some(avs_message)) => { - Some(format!("{}, avs_message: {}", details, avs_message)) + Some(format!("{details}, avs_message: {avs_message}")) } (Some(message), None, None) => Some(message), (None, Some(details), None) => Some(details), diff --git a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs index 93c087e370..642ff51001 100644 --- a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs +++ b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs @@ -204,8 +204,7 @@ impl ConnectorCommon for Bluesnap { { ( format!( - "{} in bluesnap dashboard", - REQUEST_TIMEOUT_PAYMENT_NOT_FOUND + "{REQUEST_TIMEOUT_PAYMENT_NOT_FOUND} in bluesnap dashboard", ), Some(enums::AttemptStatus::Failure), // when bluesnap throws 403 for payment not found, we update the payment status to failure. ) diff --git a/crates/hyperswitch_connectors/src/connectors/cryptopay.rs b/crates/hyperswitch_connectors/src/connectors/cryptopay.rs index 17cef97add..e2c3b3409a 100644 --- a/crates/hyperswitch_connectors/src/connectors/cryptopay.rs +++ b/crates/hyperswitch_connectors/src/connectors/cryptopay.rs @@ -115,10 +115,7 @@ where let auth = cryptopay::CryptopayAuthType::try_from(&req.connector_auth_type)?; - let sign_req: String = format!( - "{}\n{}\n{}\n{}\n{}", - api_method, payload, content_type, date, api - ); + let sign_req: String = format!("{api_method}\n{payload}\n{content_type}\n{date}\n{api}"); let authz = crypto::HmacSha1::sign_message( &crypto::HmacSha1, auth.api_secret.peek().as_bytes(), diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs index 09b468c3ca..55528604a7 100644 --- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs @@ -4263,18 +4263,16 @@ pub fn get_error_reason( ) -> Option { match (error_info, detailed_error_info, avs_error_info) { (Some(message), Some(details), Some(avs_message)) => Some(format!( - "{}, detailed_error_information: {}, avs_message: {}", - message, details, avs_message - )), - (Some(message), Some(details), None) => Some(format!( - "{}, detailed_error_information: {}", - message, details + "{message}, detailed_error_information: {details}, avs_message: {avs_message}", )), + (Some(message), Some(details), None) => { + Some(format!("{message}, detailed_error_information: {details}")) + } (Some(message), None, Some(avs_message)) => { - Some(format!("{}, avs_message: {}", message, avs_message)) + Some(format!("{message}, avs_message: {avs_message}")) } (None, Some(details), Some(avs_message)) => { - Some(format!("{}, avs_message: {}", details, avs_message)) + Some(format!("{details}, avs_message: {avs_message}")) } (Some(message), None, None) => Some(message), (None, Some(details), None) => Some(details), diff --git a/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs b/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs index 76e2617717..173a1aa438 100644 --- a/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs @@ -580,8 +580,8 @@ impl } DatatransResponse::ThreeDSResponse(response) => { let redirection_link = match item.data.test_mode { - Some(true) => format!("{}/v1/start", REDIRECTION_SBX_URL), - Some(false) | None => format!("{}/v1/start", REDIRECTION_PROD_URL), + Some(true) => format!("{REDIRECTION_SBX_URL}/v1/start"), + Some(false) | None => format!("{REDIRECTION_PROD_URL}/v1/start"), }; Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( @@ -652,8 +652,8 @@ impl } DatatransResponse::ThreeDSResponse(response) => { let redirection_link = match item.data.test_mode { - Some(true) => format!("{}/v1/start", REDIRECTION_SBX_URL), - Some(false) | None => format!("{}/v1/start", REDIRECTION_PROD_URL), + Some(true) => format!("{REDIRECTION_SBX_URL}/v1/start"), + Some(false) | None => format!("{REDIRECTION_PROD_URL}/v1/start"), }; Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( diff --git a/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs index c04ada6c57..9e7d4a06a2 100644 --- a/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/facilitapay/transformers.rs @@ -230,9 +230,8 @@ pub fn parse_facilitapay_error_response( Err(_) => ( "Invalid response format received".to_string(), format!( - "Unable to parse response as JSON or UTF-8 string. Status code: {}", - status_code - ), + "Unable to parse response as JSON or UTF-8 string. Status code: {status_code}", + ), ), }, }; @@ -265,7 +264,7 @@ fn extract_message_from_json(json: &serde_json::Value) -> String { return obj .iter() .next() - .map(|(k, v)| format!("{}: {}", k, v)) + .map(|(k, v)| format!("{k}: {v}")) .unwrap_or_else(|| "Unknown error".to_string()); } } else if let Some(s) = json.as_str() { diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu.rs b/crates/hyperswitch_connectors/src/connectors/fiuu.rs index f29c0866b6..1c6337e112 100644 --- a/crates/hyperswitch_connectors/src/connectors/fiuu.rs +++ b/crates/hyperswitch_connectors/src/connectors/fiuu.rs @@ -420,7 +420,7 @@ impl ConnectorIntegration for Fiu connectors: &Connectors, ) -> CustomResult { let base_url = connectors.fiuu.secondary_base_url.clone(); - Ok(format!("{}RMS/API/gate-query/index.php", base_url)) + Ok(format!("{base_url}RMS/API/gate-query/index.php")) } fn get_request_body( &self, @@ -512,7 +512,7 @@ impl ConnectorIntegration fo connectors: &Connectors, ) -> CustomResult { let base_url = connectors.fiuu.secondary_base_url.clone(); - Ok(format!("{}RMS/API/capstxn/index.php", base_url)) + Ok(format!("{base_url}RMS/API/capstxn/index.php")) } fn get_request_body( @@ -586,7 +586,7 @@ impl ConnectorIntegration for Fi connectors: &Connectors, ) -> CustomResult { let base_url = connectors.fiuu.secondary_base_url.clone(); - Ok(format!("{}RMS/API/refundAPI/refund.php", base_url)) + Ok(format!("{base_url}RMS/API/refundAPI/refund.php")) } fn get_request_body( @@ -651,7 +651,7 @@ impl ConnectorIntegration for Fiuu { connectors: &Connectors, ) -> CustomResult { let base_url = connectors.fiuu.secondary_base_url.clone(); - Ok(format!("{}RMS/API/refundAPI/index.php", base_url)) + Ok(format!("{base_url}RMS/API/refundAPI/index.php")) } fn get_request_body( @@ -723,7 +723,7 @@ impl ConnectorIntegration for Fiuu { connectors: &Connectors, ) -> CustomResult { let base_url = connectors.fiuu.secondary_base_url.clone(); - Ok(format!("{}RMS/API/refundAPI/q_by_txn.php", base_url)) + Ok(format!("{base_url}RMS/API/refundAPI/q_by_txn.php")) } fn get_request_body( diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs index 52a26f9d39..bb7896af13 100644 --- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs @@ -192,7 +192,7 @@ impl TryFrom for BankCode { BankNames::UobBank => Ok(Self::UOVBMYKL), BankNames::OcbcBank => Ok(Self::OCBCMYKL), bank => Err(errors::ConnectorError::NotSupported { - message: format!("Invalid BankName for FPX Refund: {:?}", bank), + message: format!("Invalid BankName for FPX Refund: {bank:?}"), connector: "Fiuu", })?, } diff --git a/crates/hyperswitch_connectors/src/connectors/getnet.rs b/crates/hyperswitch_connectors/src/connectors/getnet.rs index 1aa41c801e..12c59f92e5 100644 --- a/crates/hyperswitch_connectors/src/connectors/getnet.rs +++ b/crates/hyperswitch_connectors/src/connectors/getnet.rs @@ -325,8 +325,7 @@ impl ConnectorIntegration for Get .change_context(errors::ConnectorError::MissingConnectorTransactionID)?; Ok(format!( - "{}/merchants/{}/payments/{}", - endpoint, merchant_id, transaction_id + "{endpoint}/merchants/{merchant_id}/payments/{transaction_id}", )) } @@ -649,8 +648,7 @@ impl ConnectorIntegration for Getnet { let transaction_id = req.request.connector_transaction_id.clone(); Ok(format!( - "{}/merchants/{}/payments/{}", - endpoint, merchant_id, transaction_id + "{endpoint}/merchants/{merchant_id}/payments/{transaction_id}", )) } diff --git a/crates/hyperswitch_connectors/src/connectors/gpayments.rs b/crates/hyperswitch_connectors/src/connectors/gpayments.rs index 85778efd5f..946879d8b7 100644 --- a/crates/hyperswitch_connectors/src/connectors/gpayments.rs +++ b/crates/hyperswitch_connectors/src/connectors/gpayments.rs @@ -429,7 +429,7 @@ impl ConnectorIntegration CustomResult { let base_url = build_endpoint(self.base_url(connectors), &req.connector_meta_data)?; - Ok(format!("{}/api/v2/auth/brw/init?mode=custom", base_url,)) + Ok(format!("{base_url}/api/v2/auth/brw/init?mode=custom")) } fn get_request_body( @@ -520,7 +520,7 @@ impl connectors: &Connectors, ) -> CustomResult { let base_url = build_endpoint(self.base_url(connectors), &req.connector_meta_data)?; - Ok(format!("{}/api/v2/auth/enrol", base_url,)) + Ok(format!("{base_url}/api/v2/auth/enrol")) } fn get_request_body( diff --git a/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs index e9477449c1..6f327c2239 100644 --- a/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs @@ -223,7 +223,7 @@ impl amount: item.amount, currency: item.router_data.request.currency, country, - locale: format!("en-{}", country), + locale: format!("en-{country}"), redirect_urls: get_redirect_url(return_url), payer_info, notification_url: item.router_data.request.get_webhook_url()?, diff --git a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs index 043f140a17..80e3d61278 100644 --- a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs +++ b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs @@ -216,7 +216,7 @@ impl ConnectorIntegration ); let encoded_creds = common_utils::consts::BASE64_ENGINE.encode(creds); - let auth_string = format!("Basic {}", encoded_creds); + let auth_string = format!("Basic {encoded_creds}"); Ok(vec![ ( headers::CONTENT_TYPE.to_string(), diff --git a/crates/hyperswitch_connectors/src/connectors/klarna.rs b/crates/hyperswitch_connectors/src/connectors/klarna.rs index a0f2cafe25..f195823e8c 100644 --- a/crates/hyperswitch_connectors/src/connectors/klarna.rs +++ b/crates/hyperswitch_connectors/src/connectors/klarna.rs @@ -772,7 +772,7 @@ impl ConnectorIntegration Ok(format!("{endpoint}checkout/v3/orders",)), + ) => Ok(format!("{endpoint}checkout/v3/orders")), #[cfg(feature = "v1")] ( common_enums::PaymentExperience::DisplayQrCode diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera.rs b/crates/hyperswitch_connectors/src/connectors/netcetera.rs index 9a5ecdfd8c..36fa194ca1 100644 --- a/crates/hyperswitch_connectors/src/connectors/netcetera.rs +++ b/crates/hyperswitch_connectors/src/connectors/netcetera.rs @@ -260,7 +260,7 @@ impl ConnectorIntegration CustomResult { let base_url = build_endpoint(self.base_url(connectors), &req.connector_meta_data)?; - Ok(format!("{}/3ds/versioning", base_url,)) + Ok(format!("{base_url}/3ds/versioning")) } fn get_request_body( @@ -352,7 +352,7 @@ impl connectors: &Connectors, ) -> CustomResult { let base_url = build_endpoint(self.base_url(connectors), &req.connector_meta_data)?; - Ok(format!("{}/3ds/authentication", base_url,)) + Ok(format!("{base_url}/3ds/authentication")) } fn get_request_body( diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets.rs b/crates/hyperswitch_connectors/src/connectors/nexinets.rs index de6f6f5cd3..08084973c5 100644 --- a/crates/hyperswitch_connectors/src/connectors/nexinets.rs +++ b/crates/hyperswitch_connectors/src/connectors/nexinets.rs @@ -157,7 +157,7 @@ impl ConnectorCommon for Nexinets { message.push_str(&msg); static_message.push_str(&msg); } else { - message.push_str(format!(", {}", msg).as_str()); + message.push_str(format!(", {msg}").as_str()); } } let connector_reason = format!("reason : {} , message : {}", response.message, message); diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs index 4e30b1a6ef..6a98851eb4 100644 --- a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs @@ -167,8 +167,8 @@ where return Err(error_stack::Report::from( errors::ConnectorError::MaxFieldLengthViolated { field_name: format!( - "{0}.address.first_name & {0}.address.last_name", - address_type_str + "{address_type_str}.address.first_name & {address_type_str}.address.last_name", + ), connector: "Nexixpay".to_string(), max_length: max_name_len, @@ -184,8 +184,7 @@ where return Err(error_stack::Report::from( errors::ConnectorError::MaxFieldLengthViolated { field_name: format!( - "{0}.address.line1 & {0}.address.line2", - address_type_str + "{address_type_str}.address.line1 & {address_type_str}.address.line2", ), connector: "Nexixpay".to_string(), max_length: max_street_len, @@ -201,7 +200,7 @@ where if length > max_city_len { return Err(error_stack::Report::from( errors::ConnectorError::MaxFieldLengthViolated { - field_name: format!("{}.address.city", address_type_str), + field_name: format!("{address_type_str}.address.city"), connector: "Nexixpay".to_string(), max_length: max_city_len, received_length: length, @@ -216,7 +215,7 @@ where if length > max_post_code_len { return Err(error_stack::Report::from( errors::ConnectorError::MaxFieldLengthViolated { - field_name: format!("{}.address.zip", address_type_str), + field_name: format!("{address_type_str}.address.zip"), connector: "Nexixpay".to_string(), max_length: max_post_code_len, received_length: length, @@ -231,7 +230,7 @@ where if length > max_country_len { return Err(error_stack::Report::from( errors::ConnectorError::MaxFieldLengthViolated { - field_name: format!("{}.address.country", address_type_str), + field_name: format!("{address_type_str}.address.country"), connector: "Nexixpay".to_string(), max_length: max_country_len, received_length: length, diff --git a/crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs index 99f3d3aac8..832b39f6f4 100644 --- a/crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs @@ -784,10 +784,10 @@ impl TryFrom<&PaymentsCancelRouterData> for NmiCancelRequest { let auth = NmiAuthType::try_from(&item.connector_auth_type)?; match &item.request.cancellation_reason { Some(cancellation_reason) => { - let void_reason: NmiVoidReason = serde_json::from_str(&format!("\"{}\"", cancellation_reason)) + let void_reason: NmiVoidReason = serde_json::from_str(&format!("\"{cancellation_reason}\"", )) .map_err(|_| ConnectorError::NotSupported { - message: format!("Json deserialise error: unknown variant `{}` expected to be one of `fraud`, `user_cancel`, `icc_rejected`, `icc_card_removed`, `icc_no_confirmation`, `pos_timeout`. This cancellation_reason", cancellation_reason), - connector: "nmi" + message: format!("Json deserialise error: unknown variant `{cancellation_reason}` expected to be one of `fraud`, `user_cancel`, `icc_rejected`, `icc_card_removed`, `icc_no_confirmation`, `pos_timeout`. This cancellation_reason"), + connector: "nmi" })?; Ok(Self { transaction_type: TransactionType::Void, diff --git a/crates/hyperswitch_connectors/src/connectors/nomupay.rs b/crates/hyperswitch_connectors/src/connectors/nomupay.rs index 6b2516d120..4628a08de9 100644 --- a/crates/hyperswitch_connectors/src/connectors/nomupay.rs +++ b/crates/hyperswitch_connectors/src/connectors/nomupay.rs @@ -154,7 +154,7 @@ fn get_signature( let jws_detached = jws_blocks .first() .zip(jws_blocks.get(2)) - .map(|(first, third)| format!("{}..{}", first, third)) + .map(|(first, third)| format!("{first}..{third}")) .ok_or_else(|| errors::ConnectorError::MissingRequiredField { field_name: "JWS blocks not sufficient for detached payload", })?; diff --git a/crates/hyperswitch_connectors/src/connectors/nomupay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nomupay/transformers.rs index 3eab923ff1..1d47ed5639 100644 --- a/crates/hyperswitch_connectors/src/connectors/nomupay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/nomupay/transformers.rs @@ -449,7 +449,7 @@ impl TryFrom<&PayoutsRouterData> for OnboardTransferMethodRequest { }) } other_bank => Err(errors::ConnectorError::NotSupported { - message: format!("{:?} is not supported", other_bank), + message: format!("{other_bank:?} is not supported"), connector: "nomupay", } .into()), diff --git a/crates/hyperswitch_connectors/src/connectors/noon.rs b/crates/hyperswitch_connectors/src/connectors/noon.rs index 5b753bcdef..6eb1cabcb9 100644 --- a/crates/hyperswitch_connectors/src/connectors/noon.rs +++ b/crates/hyperswitch_connectors/src/connectors/noon.rs @@ -120,8 +120,7 @@ fn get_auth_header( .zip(auth.api_key) .map(|((business_identifier, application_identifier), api_key)| { common_utils::consts::BASE64_ENGINE.encode(format!( - "{}.{}:{}", - business_identifier, application_identifier, api_key + "{business_identifier}.{application_identifier}:{api_key}", )) }); diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet.rs b/crates/hyperswitch_connectors/src/connectors/novalnet.rs index 0a6201c959..1f7fb69f38 100644 --- a/crates/hyperswitch_connectors/src/connectors/novalnet.rs +++ b/crates/hyperswitch_connectors/src/connectors/novalnet.rs @@ -238,7 +238,7 @@ impl ConnectorIntegration CustomResult { let endpoint = self.base_url(connectors); - Ok(format!("{}/payment", endpoint)) + Ok(format!("{endpoint}/payment")) } fn get_request_body( @@ -315,8 +315,8 @@ impl ConnectorIntegration CustomResult { let endpoint = self.base_url(connectors); match req.request.is_auto_capture()? { - true => Ok(format!("{}/payment", endpoint)), - false => Ok(format!("{}/authorize", endpoint)), + true => Ok(format!("{endpoint}/payment")), + false => Ok(format!("{endpoint}/authorize")), } } @@ -405,7 +405,7 @@ impl ConnectorIntegration for Nov connectors: &Connectors, ) -> CustomResult { let endpoint = self.base_url(connectors); - Ok(format!("{}/transaction/details", endpoint)) + Ok(format!("{endpoint}/transaction/details")) } fn get_request_body( @@ -482,7 +482,7 @@ impl ConnectorIntegration fo connectors: &Connectors, ) -> CustomResult { let endpoint = self.base_url(connectors); - Ok(format!("{}/transaction/capture", endpoint)) + Ok(format!("{endpoint}/transaction/capture")) } fn get_request_body( @@ -568,7 +568,7 @@ impl ConnectorIntegration for Novalne connectors: &Connectors, ) -> CustomResult { let endpoint = self.base_url(connectors); - Ok(format!("{}/transaction/refund", endpoint)) + Ok(format!("{endpoint}/transaction/refund")) } fn get_request_body( @@ -653,7 +653,7 @@ impl ConnectorIntegration for Novalnet connectors: &Connectors, ) -> CustomResult { let endpoint = self.base_url(connectors); - Ok(format!("{}/transaction/details", endpoint)) + Ok(format!("{endpoint}/transaction/details")) } fn get_request_body( @@ -730,7 +730,7 @@ impl ConnectorIntegration for No connectors: &Connectors, ) -> CustomResult { let endpoint = self.base_url(connectors); - Ok(format!("{}/transaction/cancel", endpoint)) + Ok(format!("{endpoint}/transaction/cancel")) } fn get_request_body( diff --git a/crates/hyperswitch_connectors/src/connectors/payeezy.rs b/crates/hyperswitch_connectors/src/connectors/payeezy.rs index c999bfc70c..7dbdaceb66 100644 --- a/crates/hyperswitch_connectors/src/connectors/payeezy.rs +++ b/crates/hyperswitch_connectors/src/connectors/payeezy.rs @@ -75,10 +75,7 @@ where let nonce = rand::distributions::Alphanumeric.sample_string(&mut rand::thread_rng(), 19); let signature_string = auth.api_key.clone().zip(auth.merchant_token.clone()).map( |(api_key, merchant_token)| { - format!( - "{}{}{}{}{}", - api_key, nonce, timestamp, merchant_token, request_payload - ) + format!("{api_key}{nonce}{timestamp}{merchant_token}{request_payload}") }, ); let key = hmac::Key::new(hmac::HMAC_SHA256, auth.api_secret.expose().as_bytes()); diff --git a/crates/hyperswitch_connectors/src/connectors/paypal.rs b/crates/hyperswitch_connectors/src/connectors/paypal.rs index e33c2e0d3a..578baba88b 100644 --- a/crates/hyperswitch_connectors/src/connectors/paypal.rs +++ b/crates/hyperswitch_connectors/src/connectors/paypal.rs @@ -317,7 +317,7 @@ impl ConnectorCommon for Paypal { .iter() .try_fold(String::new(), |mut acc, error| { if let Some(description) = &error.description { - write!(acc, "description - {} ;", description) + write!(acc, "description - {description} ;") .change_context( errors::ConnectorError::ResponseDeserializationFailed, ) @@ -1403,7 +1403,7 @@ impl ConnectorIntegration for Pay "Missing Authorize id".to_string(), ), )?; - format!("v2/payments/authorizations/{authorize_id}",) + format!("v2/payments/authorizations/{authorize_id}") } transformers::PaypalPaymentIntent::Capture => { let capture_id = paypal_meta.capture_id.ok_or( diff --git a/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs index 18c7ac02e7..8cabfcf466 100644 --- a/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs @@ -864,8 +864,8 @@ impl TryFrom<&PaypalRouterData<&SdkSessionUpdateRouterData>> for PaypalUpdateOrd // Create separate paths for amount and items let reference_id = &item.router_data.connector_request_reference_id; - let amount_path = format!("/purchase_units/@reference_id=='{}'/amount", reference_id); - let items_path = format!("/purchase_units/@reference_id=='{}'/items", reference_id); + let amount_path = format!("/purchase_units/@reference_id=='{reference_id}'/amount"); + let items_path = format!("/purchase_units/@reference_id=='{reference_id}'/items"); let amount_value = Value::Amount(OrderRequestAmount::try_from(item)?); diff --git a/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs b/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs index ebdd048c68..efd1f74fbe 100644 --- a/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs @@ -361,7 +361,7 @@ impl TryFrom<&Option> for RedsysCardData { Some(PaymentMethodData::Card(card)) => { let year = card.get_card_expiry_year_2_digit()?.expose(); let month = card.get_card_expiry_month_2_digit()?.expose(); - let expiry_date = Secret::new(format!("{}{}", year, month)); + let expiry_date = Secret::new(format!("{year}{month}")); Ok(Self { card_number: card.card_number.clone(), expiry_date, @@ -886,7 +886,7 @@ fn get_redsys_attempt_status( | "0912" | "9064" | "9078" | "9093" | "9094" | "9104" | "9218" | "9253" | "9261" | "9915" | "9997" | "9999" => Ok(enums::AttemptStatus::Failure), error => Err(errors::ConnectorError::ResponseHandlingFailed) - .attach_printable(format!("Received Unknown Status:{}", error))?, + .attach_printable(format!("Received Unknown Status:{error}"))?, } } } @@ -1407,7 +1407,7 @@ impl TryFrom for enums::RefundStatus { "9999" => Ok(Self::Pending), "0950" | "0172" | "174" => Ok(Self::Failure), unknown_status => Err(errors::ConnectorError::ResponseHandlingFailed) - .attach_printable(format!("Received unknown status:{}", unknown_status))?, + .attach_printable(format!("Received unknown status:{unknown_status}"))?, } } } @@ -1601,10 +1601,7 @@ fn get_transaction_type( }), }, other_attempt_status => Err(errors::ConnectorError::NotSupported { - message: format!( - "Payment sync after terminal status: {} payment", - other_attempt_status - ), + message: format!("Payment sync after terminal status: {other_attempt_status} payment"), connector: "redsys", }), } diff --git a/crates/hyperswitch_connectors/src/connectors/riskified/transformers/api.rs b/crates/hyperswitch_connectors/src/connectors/riskified/transformers/api.rs index 7ce3ac979e..61a4d8e157 100644 --- a/crates/hyperswitch_connectors/src/connectors/riskified/transformers/api.rs +++ b/crates/hyperswitch_connectors/src/connectors/riskified/transformers/api.rs @@ -267,7 +267,7 @@ impl TryFrom<&RiskifiedRouterData<&FrmCheckoutRouterData>> for RiskifiedPayments credit_card_number: card_info .last4 .clone() - .map(|last_four| format!("XXXX-XXXX-XXXX-{}", last_four)) + .map(|last_four| format!("XXXX-XXXX-XXXX-{last_four}")) .map(Secret::new), credit_card_company: card_info.card_network.clone(), }), diff --git a/crates/hyperswitch_connectors/src/connectors/santander.rs b/crates/hyperswitch_connectors/src/connectors/santander.rs index 22858f75db..5e048ae919 100644 --- a/crates/hyperswitch_connectors/src/connectors/santander.rs +++ b/crates/hyperswitch_connectors/src/connectors/santander.rs @@ -179,7 +179,7 @@ impl ConnectorIntegration ); let encoded_creds = common_utils::consts::BASE64_ENGINE.encode(creds); - let auth_string = format!("Basic {}", encoded_creds); + let auth_string = format!("Basic {encoded_creds}"); Ok(vec![ ( headers::CONTENT_TYPE.to_string(), diff --git a/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs b/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs index d5df661a30..5755e7577b 100644 --- a/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/santander/transformers.rs @@ -128,7 +128,7 @@ pub fn generate_emv_string( // Compute CRC16-CCITT (False) checksum let crc = Crc::::new(&CRC_16_CCITT_FALSE); let checksum = crc.checksum(emv.as_bytes()); - emv += &format!("{:04X}", checksum); + emv += &format!("{checksum:04X}"); emv } diff --git a/crates/hyperswitch_connectors/src/connectors/stripe.rs b/crates/hyperswitch_connectors/src/connectors/stripe.rs index 695825a156..a7146fab9c 100644 --- a/crates/hyperswitch_connectors/src/connectors/stripe.rs +++ b/crates/hyperswitch_connectors/src/connectors/stripe.rs @@ -379,7 +379,7 @@ impl ConnectorIntegration fo .decline_code .clone() .map(|decline_code| { - format!("message - {}, decline_code - {}", message, decline_code) + format!("message - {message}, decline_code - {decline_code}") }) .unwrap_or(message) }), @@ -844,7 +844,7 @@ impl ConnectorIntegration for Str .decline_code .clone() .map(|decline_code| { - format!("message - {}, decline_code - {}", message, decline_code) + format!("message - {message}, decline_code - {decline_code}") }) .unwrap_or(message) }), @@ -1017,7 +1017,7 @@ impl ConnectorIntegration for St .decline_code .clone() .map(|decline_code| { - format!("message - {}, decline_code - {}", message, decline_code) + format!("message - {message}, decline_code - {decline_code}") }) .unwrap_or(message) }), @@ -1352,7 +1352,7 @@ impl ConnectorIntegration for Stripe .decline_code .clone() .map(|decline_code| { - format!("message - {}, decline_code - {}", message, decline_code) + format!("message - {message}, decline_code - {decline_code}") }) .unwrap_or(message) }), @@ -1648,7 +1648,7 @@ impl ConnectorIntegration for Stripe { .decline_code .clone() .map(|decline_code| { - format!("message - {}, decline_code - {}", message, decline_code) + format!("message - {message}, decline_code - {decline_code}") }) .unwrap_or(message) }), @@ -1792,7 +1792,7 @@ impl ConnectorIntegration for .decline_code .clone() .map(|decline_code| { - format!("message - {}, decline_code - {}", message, decline_code) + format!("message - {message}, decline_code - {decline_code}") }) .unwrap_or(message) }), @@ -1892,7 +1892,7 @@ impl ConnectorIntegration) -> HashMap { // Detached JWT (GET requests) - sign only the header with a dot - let signing_input = format!("{}.", encoded_header); + let signing_input = format!("{encoded_header}."); (String::new(), signing_input) // Empty payload for detached JWT } }; @@ -151,8 +151,7 @@ impl Tokenio { // Assemble JWT - for detached JWT, middle part is empty Ok(format!( - "{}.{}.{}", - encoded_header, encoded_payload, encoded_signature + "{encoded_header}.{encoded_payload}.{encoded_signature}", )) } @@ -353,7 +352,7 @@ impl ConnectorIntegration CustomResult { let base_url = self.base_url(connectors); - Ok(format!("{}/v2/payments", base_url)) + Ok(format!("{base_url}/v2/payments")) } fn get_request_body( @@ -394,7 +393,7 @@ impl ConnectorIntegration for Tok ), ( headers::AUTHORIZATION.to_string(), - format!("Bearer {}", jwt).into_masked(), + format!("Bearer {jwt}").into_masked(), ), ]; Ok(headers) @@ -489,7 +488,7 @@ impl ConnectorIntegration for Tok .get_connector_transaction_id() .change_context(errors::ConnectorError::MissingConnectorTransactionID)?; let base_url = self.base_url(connectors); - Ok(format!("{}/v2/payments/{}", base_url, connector_payment_id)) + Ok(format!("{base_url}/v2/payments/{connector_payment_id}")) } fn build_request( diff --git a/crates/hyperswitch_connectors/src/connectors/trustpay.rs b/crates/hyperswitch_connectors/src/connectors/trustpay.rs index c1c713a731..3306993e6b 100644 --- a/crates/hyperswitch_connectors/src/connectors/trustpay.rs +++ b/crates/hyperswitch_connectors/src/connectors/trustpay.rs @@ -263,7 +263,7 @@ impl ConnectorIntegration format!( "Basic {}", common_utils::consts::BASE64_ENGINE - .encode(format!("{}:{}", project_id, secret_key)) + .encode(format!("{project_id}:{secret_key}")) ) }); Ok(vec![ diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs index 705a86a05d..4dcedb9d01 100644 --- a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs @@ -2395,18 +2395,16 @@ pub fn get_error_reason( ) -> Option { match (error_info, detailed_error_info, avs_error_info) { (Some(message), Some(details), Some(avs_message)) => Some(format!( - "{}, detailed_error_information: {}, avs_message: {}", - message, details, avs_message - )), - (Some(message), Some(details), None) => Some(format!( - "{}, detailed_error_information: {}", - message, details + "{message}, detailed_error_information: {details}, avs_message: {avs_message}", )), + (Some(message), Some(details), None) => { + Some(format!("{message}, detailed_error_information: {details}")) + } (Some(message), None, Some(avs_message)) => { - Some(format!("{}, avs_message: {}", message, avs_message)) + Some(format!("{message}, avs_message: {avs_message}")) } (None, Some(details), Some(avs_message)) => { - Some(format!("{}, avs_message: {}", details, avs_message)) + Some(format!("{details}, avs_message: {avs_message}")) } (Some(message), None, None) => Some(message), (None, Some(details), None) => Some(details), diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/response.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/response.rs index e0cf0d3bff..e7fa40c711 100644 --- a/crates/hyperswitch_connectors/src/connectors/worldpay/response.rs +++ b/crates/hyperswitch_connectors/src/connectors/worldpay/response.rs @@ -416,7 +416,7 @@ impl WorldpayErrorResponse { pub fn default(status_code: u16) -> Self { match status_code { code @ 404 => Self { - error_name: format!("{} Not found", code), + error_name: format!("{code} Not found"), message: "Resource not found".to_string(), validation_errors: None, }, diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs index 165eb41f76..b346b40d97 100644 --- a/crates/hyperswitch_connectors/src/utils.rs +++ b/crates/hyperswitch_connectors/src/utils.rs @@ -359,14 +359,13 @@ pub(crate) fn construct_not_implemented_error_report( capture_method: enums::CaptureMethod, connector_name: &str, ) -> error_stack::Report { - errors::ConnectorError::NotImplemented(format!("{} for {}", capture_method, connector_name)) - .into() + errors::ConnectorError::NotImplemented(format!("{capture_method} for {connector_name}")).into() } pub(crate) const SELECTED_PAYMENT_METHOD: &str = "Selected payment method"; pub(crate) fn get_unimplemented_payment_method_error_message(connector: &str) -> String { - format!("{} through {}", SELECTED_PAYMENT_METHOD, connector) + format!("{SELECTED_PAYMENT_METHOD} through {connector}") } pub(crate) fn to_connector_meta(connector_meta: Option) -> Result @@ -396,8 +395,7 @@ pub(crate) fn validate_currency( if request_currency != merchant_config_currency { Err(errors::ConnectorError::NotSupported { message: format!( - "currency {} is not supported for this merchant account", - request_currency + "currency {request_currency} is not supported for this merchant account", ), connector: "Braintree", })? @@ -1126,7 +1124,7 @@ impl CardData for Card { fn get_expiry_year_4_digit(&self) -> Secret { let mut year = self.card_exp_year.peek().clone(); if year.len() == 2 { - year = format!("20{}", year); + year = format!("20{year}"); } Secret::new(year) } @@ -1233,7 +1231,7 @@ impl CardData for CardDetailsForNetworkTransactionId { fn get_expiry_year_4_digit(&self) -> Secret { let mut year = self.card_exp_year.peek().clone(); if year.len() == 2 { - year = format!("20{}", year); + year = format!("20{year}"); } Secret::new(year) } @@ -1364,7 +1362,7 @@ impl AddressDetailsData for AddressDetails { .cloned() .unwrap_or(Secret::new("".to_string())); let last_name = last_name.peek(); - let full_name = format!("{} {}", first_name, last_name).trim().to_string(); + let full_name = format!("{first_name} {last_name}").trim().to_string(); Ok(Secret::new(full_name)) } @@ -5321,7 +5319,7 @@ pub fn is_mandate_supported( } else { match payment_method_type { Some(pm_type) => Err(errors::ConnectorError::NotSupported { - message: format!("{} mandate payment", pm_type), + message: format!("{pm_type} mandate payment"), connector, } .into()), @@ -5916,7 +5914,7 @@ impl CardData for api_models::payouts::CardPayout { fn get_expiry_year_4_digit(&self) -> Secret { let mut year = self.expiry_year.peek().clone(); if year.len() == 2 { - year = format!("20{}", year); + year = format!("20{year}"); } Secret::new(year) } @@ -5992,7 +5990,7 @@ impl NetworkTokenData for payment_method_data::NetworkTokenData { fn get_expiry_year_4_digit(&self) -> Secret { let mut year = self.token_exp_year.peek().clone(); if year.len() == 2 { - year = format!("20{}", year); + year = format!("20{year}"); } Secret::new(year) } @@ -6001,7 +5999,7 @@ impl NetworkTokenData for payment_method_data::NetworkTokenData { fn get_expiry_year_4_digit(&self) -> Secret { let mut year = self.network_token_exp_year.peek().clone(); if year.len() == 2 { - year = format!("20{}", year); + year = format!("20{year}"); } Secret::new(year) } @@ -6308,7 +6306,7 @@ where .clone() .parse_enum("Currency") .map(Some) - .map_err(|_| serde::de::Error::custom(format!("Invalid currency code: {}", value))), + .map_err(|_| serde::de::Error::custom(format!("Invalid currency code: {value}"))), _ => Ok(None), } } diff --git a/crates/hyperswitch_domain_models/src/disputes.rs b/crates/hyperswitch_domain_models/src/disputes.rs index 87ae6204ac..33db166bda 100644 --- a/crates/hyperswitch_domain_models/src/disputes.rs +++ b/crates/hyperswitch_domain_models/src/disputes.rs @@ -62,8 +62,8 @@ impl return Err(error_stack::Report::new( errors::api_error_response::ApiErrorResponse::PreconditionFailed { message: format!( - "Access not available for the given profile_id {:?}", - profile_id_from_request_body + "Access not available for the given profile_id {profile_id_from_request_body:?}", + ), }, )); diff --git a/crates/hyperswitch_domain_models/src/errors/api_error_response.rs b/crates/hyperswitch_domain_models/src/errors/api_error_response.rs index 2924093da3..5b1732657a 100644 --- a/crates/hyperswitch_domain_models/src/errors/api_error_response.rs +++ b/crates/hyperswitch_domain_models/src/errors/api_error_response.rs @@ -392,7 +392,7 @@ impl ErrorSwitch for ApiErrorRespon AER::InternalServerError(ApiError::new("HE", 0, "Something went wrong", None)) }, Self::HealthCheckError { message,component } => { - AER::InternalServerError(ApiError::new("HE",0,format!("{} health check failed with error: {}",component,message),None)) + AER::InternalServerError(ApiError::new("HE",0,format!("{component} health check failed with error: {message}"),None)) }, Self::DuplicateRefundRequest => AER::BadRequest(ApiError::new("HE", 1, "Duplicate refund request. Refund already attempted with the refund ID", None)), Self::DuplicateMandate => AER::BadRequest(ApiError::new("HE", 1, "Duplicate mandate request. Mandate already attempted with the Mandate ID", None)), @@ -693,7 +693,7 @@ impl ErrorSwitch for ApiErrorRespon } => AER::InternalServerError(ApiError::new( "IE", 0, - format!("{} as data mismatched for {}", reason, field_names), + format!("{reason} as data mismatched for {field_names}"), Some(Extra { connector_transaction_id: connector_transaction_id.to_owned(), ..Default::default() diff --git a/crates/hyperswitch_domain_models/src/payment_methods.rs b/crates/hyperswitch_domain_models/src/payment_methods.rs index aa01465408..3ca72867f0 100644 --- a/crates/hyperswitch_domain_models/src/payment_methods.rs +++ b/crates/hyperswitch_domain_models/src/payment_methods.rs @@ -967,8 +967,7 @@ impl TryFrom<(payment_methods::PaymentMethodRecord, id_type::MerchantId)> .map_err(|_| { error_stack::report!(ValidationError::InvalidValue { message: format!( - "Invalid merchant_connector_account_id: {}", - merchant_connector_id + "Invalid merchant_connector_account_id: {merchant_connector_id}" ), }) }) @@ -1124,8 +1123,7 @@ mod tests { let result_mca = MerchantConnectorAccountId::wrap("mca_kGz30G8B95MxRwmeQqy6".to_string()); assert!( result_mca.is_ok(), - "Expected Ok, but got Err: {:?}", - result_mca + "Expected Ok, but got Err: {result_mca:?}", ); let mca = result_mca.unwrap(); assert!(payments.0.contains_key(&mca)); @@ -1167,8 +1165,7 @@ mod tests { let result_mca = MerchantConnectorAccountId::wrap("mca_DAHVXbXpbYSjnL7fQWEs".to_string()); assert!( result_mca.is_ok(), - "Expected Ok, but got Err: {:?}", - result_mca + "Expected Ok, but got Err: {result_mca:?}", ); let mca = result_mca.unwrap(); assert!(payouts.0.contains_key(&mca)); diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs index f22a3698db..d7c41c88b5 100644 --- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs +++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs @@ -1569,8 +1569,8 @@ where return Err(error_stack::Report::new( errors::api_error_response::ApiErrorResponse::PreconditionFailed { message: format!( - "Access not available for the given profile_id {:?}", - inaccessible_profile_ids + "Access not available for the given profile_id {inaccessible_profile_ids:?}", + ), }, )); diff --git a/crates/hyperswitch_domain_models/src/refunds.rs b/crates/hyperswitch_domain_models/src/refunds.rs index 7a110cadbf..151937799f 100644 --- a/crates/hyperswitch_domain_models/src/refunds.rs +++ b/crates/hyperswitch_domain_models/src/refunds.rs @@ -77,8 +77,8 @@ impl return Err(error_stack::Report::new( errors::api_error_response::ApiErrorResponse::PreconditionFailed { message: format!( - "Access not available for the given profile_id {:?}", - profile_id_from_request_body + "Access not available for the given profile_id {profile_id_from_request_body:?}", + ), }, )); diff --git a/crates/hyperswitch_interfaces/src/api.rs b/crates/hyperswitch_interfaces/src/api.rs index 82da16a541..db65b14c35 100644 --- a/crates/hyperswitch_interfaces/src/api.rs +++ b/crates/hyperswitch_interfaces/src/api.rs @@ -615,7 +615,7 @@ pub trait ConnectorValidation: ConnectorCommon + ConnectorSpecifications { let connector = self.id(); match pm_type { Some(pm_type) => Err(errors::ConnectorError::NotSupported { - message: format!("{} mandate payment", pm_type), + message: format!("{pm_type} mandate payment"), connector, } .into()), @@ -692,7 +692,7 @@ fn get_connector_payment_method_type_info( .map(|pmt| { payment_method_details.get(&pmt).cloned().ok_or_else(|| { errors::ConnectorError::NotSupported { - message: format!("{} {}", payment_method, pmt), + message: format!("{payment_method} {pmt}"), connector, } .into() diff --git a/crates/hyperswitch_interfaces/src/events/routing_api_logs.rs b/crates/hyperswitch_interfaces/src/events/routing_api_logs.rs index f7c61e3890..efeefc851b 100644 --- a/crates/hyperswitch_interfaces/src/events/routing_api_logs.rs +++ b/crates/hyperswitch_interfaces/src/events/routing_api_logs.rs @@ -33,7 +33,7 @@ impl fmt::Display for ApiMethod { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Grpc => write!(f, "Grpc"), - Self::Rest(method) => write!(f, "Rest ({})", method), + Self::Rest(method) => write!(f, "Rest ({method})"), } } } diff --git a/crates/hyperswitch_interfaces/src/integrity.rs b/crates/hyperswitch_interfaces/src/integrity.rs index 43d7f4b317..6fd3be9e5f 100644 --- a/crates/hyperswitch_interfaces/src/integrity.rs +++ b/crates/hyperswitch_interfaces/src/integrity.rs @@ -351,5 +351,5 @@ impl GetIntegrityObject for PaymentsSyncData { #[inline] fn format_mismatch(field: &str, expected: &str, found: &str) -> String { - format!("{} expected {} but found {}", field, expected, found) + format!("{field} expected {expected} but found {found}") } diff --git a/crates/hyperswitch_interfaces/src/webhooks.rs b/crates/hyperswitch_interfaces/src/webhooks.rs index 6a243cf09f..3c7e3c04c3 100644 --- a/crates/hyperswitch_interfaces/src/webhooks.rs +++ b/crates/hyperswitch_interfaces/src/webhooks.rs @@ -109,10 +109,8 @@ pub trait IncomingWebhook: ConnectorCommon + Sync { connector_name: &str, connector_webhook_details: Option, ) -> CustomResult { - let debug_suffix = format!( - "For merchant_id: {:?}, and connector_name: {}", - merchant_id, connector_name - ); + let debug_suffix = + format!("For merchant_id: {merchant_id:?}, and connector_name: {connector_name}"); let default_secret = "default_secret".to_string(); let merchant_secret = match connector_webhook_details { Some(merchant_connector_webhook_details) => { @@ -123,8 +121,7 @@ pub trait IncomingWebhook: ConnectorCommon + Sync { .change_context_lazy(|| errors::ConnectorError::WebhookSourceVerificationFailed) .attach_printable_lazy(|| { format!( - "Deserializing MerchantConnectorWebhookDetails failed {}", - debug_suffix + "Deserializing MerchantConnectorWebhookDetails failed {debug_suffix}", ) })?; api_models::webhooks::ConnectorWebhookSecrets { diff --git a/crates/masking/src/secret.rs b/crates/masking/src/secret.rs index d69fccc9f1..7706e019f0 100644 --- a/crates/masking/src/secret.rs +++ b/crates/masking/src/secret.rs @@ -192,7 +192,7 @@ impl Strategy for JsonMaskStrategy { write!(f, ", ")?; } first = false; - write!(f, "\"{}\":", key)?; + write!(f, "\"{key}\":")?; Self::fmt(val, f)?; } write!(f, "}}") @@ -224,14 +224,14 @@ impl Strategy for JsonMaskStrategy { &s[s.len() - 1..s.len()] ) }; - write!(f, "\"{}\"", masked) + write!(f, "\"{masked}\"") } serde_json::Value::Number(n) => { // For numbers, we can show the order of magnitude if n.is_i64() || n.is_u64() { let num_str = n.to_string(); let masked_num = "*".repeat(num_str.len()); - write!(f, "{}", masked_num) + write!(f, "{masked_num}") } else if n.is_f64() { // For floats, just use a generic mask write!(f, "**.**") @@ -295,7 +295,7 @@ mod tests { // Apply the JsonMaskStrategy let secret = Secret::<_, JsonMaskStrategy>::new(original.clone()); - let masked_str = format!("{:?}", secret); + let masked_str = format!("{secret:?}"); // Get specific values from original let original_obj = original.as_object().expect("Original should be an object"); @@ -372,45 +372,37 @@ mod tests { // Check that the masked output includes the expected masked patterns assert!( masked_str.contains(&expected_name_mask), - "Name not masked correctly. Expected: {}", - expected_name_mask + "Name not masked correctly. Expected: {expected_name_mask}" ); assert!( masked_str.contains(&expected_email_mask), - "Email not masked correctly. Expected: {}", - expected_email_mask + "Email not masked correctly. Expected: {expected_email_mask}", ); assert!( masked_str.contains(&expected_card_mask), - "Card number not masked correctly. Expected: {}", - expected_card_mask + "Card number not masked correctly. Expected: {expected_card_mask}", ); assert!( masked_str.contains(&expected_tag1_mask), - "Tag not masked correctly. Expected: {}", - expected_tag1_mask + "Tag not masked correctly. Expected: {expected_tag1_mask}", ); assert!( masked_str.contains(&expected_short_mask), - "Short string not masked correctly. Expected: {}", - expected_short_mask + "Short string not masked correctly. Expected: {expected_short_mask}", ); assert!( masked_str.contains(&expected_age_mask), - "Age not masked correctly. Expected: {}", - expected_age_mask + "Age not masked correctly. Expected: {expected_age_mask}", ); assert!( masked_str.contains(&expected_cvv_mask), - "CVV not masked correctly. Expected: {}", - expected_cvv_mask + "CVV not masked correctly. Expected: {expected_cvv_mask}", ); assert!( masked_str.contains(expected_verified_mask), - "Boolean not masked correctly. Expected: {}", - expected_verified_mask + "Boolean not masked correctly. Expected: {expected_verified_mask}", ); // Check structure preservation diff --git a/crates/payment_methods/src/core/migration.rs b/crates/payment_methods/src/core/migration.rs index 6b7ce30b4c..ea9b6db103 100644 --- a/crates/payment_methods/src/core/migration.rs +++ b/crates/payment_methods/src/core/migration.rs @@ -36,7 +36,7 @@ pub async fn migrate_payment_methods( mca_ids.as_ref(), )) .map_err(|err| errors::ApiErrorResponse::InvalidRequestData { - message: format!("error: {:?}", err), + message: format!("error: {err:?}"), }) .attach_printable("record deserialization failed"); @@ -94,10 +94,7 @@ impl MerchantConnectorValidator { let mca_id = common_utils::id_type::MerchantConnectorAccountId::wrap(trimmed_id.to_string()) .map_err(|_| errors::ApiErrorResponse::InvalidRequestData { - message: format!( - "Invalid merchant_connector_account_id: {}", - trimmed_id - ), + message: format!("Invalid merchant_connector_account_id: {trimmed_id}"), })?; result.push(mca_id); } diff --git a/crates/redis_interface/src/commands.rs b/crates/redis_interface/src/commands.rs index affd2b0faa..9cb413bc78 100644 --- a/crates/redis_interface/src/commands.rs +++ b/crates/redis_interface/src/commands.rs @@ -1068,7 +1068,7 @@ mod tests { "#; let mut keys_and_values = HashMap::new(); for i in 0..10 { - keys_and_values.insert(format!("key{}", i), i); + keys_and_values.insert(format!("key{i}"), i); } let key = keys_and_values.keys().cloned().collect::>(); @@ -1108,7 +1108,7 @@ mod tests { "#; let mut keys_and_values = HashMap::new(); for i in 0..10 { - keys_and_values.insert(format!("key{}", i), i); + keys_and_values.insert(format!("key{i}"), i); } let key = keys_and_values.keys().cloned().collect::>(); diff --git a/crates/router/src/compatibility/wrap.rs b/crates/router/src/compatibility/wrap.rs index 37fb0e4f0b..f517cb6973 100644 --- a/crates/router/src/compatibility/wrap.rs +++ b/crates/router/src/compatibility/wrap.rs @@ -143,7 +143,7 @@ where ) { Ok(rendered_html) => api::http_response_html_data(rendered_html, None), Err(_) => { - api::http_response_err(format!("Error while rendering {} HTML page", link_type)) + api::http_response_err(format!("Error while rendering {link_type} HTML page")) } } } diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs index 8a2132a7fe..ee7b3ed820 100644 --- a/crates/router/src/configs/settings.rs +++ b/crates/router/src/configs/settings.rs @@ -1320,10 +1320,7 @@ fn deserialize_merchant_ids_inner( .map(|s| { let trimmed = s.trim(); id_type::MerchantId::wrap(trimmed.to_owned()).map_err(|error| { - format!( - "Unable to deserialize `{}` as `MerchantId`: {error}", - trimmed - ) + format!("Unable to deserialize `{trimmed}` as `MerchantId`: {error}") }) }) .fold( diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs index c518c42ad1..2996e8b42f 100644 --- a/crates/router/src/connector/utils.rs +++ b/crates/router/src/connector/utils.rs @@ -186,7 +186,7 @@ where pub const SELECTED_PAYMENT_METHOD: &str = "Selected payment method"; pub fn get_unimplemented_payment_method_error_message(connector: &str) -> String { - format!("{} through {}", SELECTED_PAYMENT_METHOD, connector) + format!("{SELECTED_PAYMENT_METHOD} through {connector}") } impl RouterData for types::RouterData { @@ -1446,7 +1446,7 @@ impl CardData for payouts::CardPayout { fn get_expiry_year_4_digit(&self) -> Secret { let mut year = self.expiry_year.peek().clone(); if year.len() == 2 { - year = format!("20{}", year); + year = format!("20{year}"); } Secret::new(year) } @@ -1521,7 +1521,7 @@ impl CardData fn get_expiry_year_4_digit(&self) -> Secret { let mut year = self.card_exp_year.peek().clone(); if year.len() == 2 { - year = format!("20{}", year); + year = format!("20{year}"); } Secret::new(year) } @@ -1594,7 +1594,7 @@ impl CardData for domain::Card { fn get_expiry_year_4_digit(&self) -> Secret { let mut year = self.card_exp_year.peek().clone(); if year.len() == 2 { - year = format!("20{}", year); + year = format!("20{year}"); } Secret::new(year) } @@ -1815,7 +1815,7 @@ impl AddressDetailsData for hyperswitch_domain_models::address::AddressDetails { .cloned() .unwrap_or(Secret::new("".to_string())); let last_name = last_name.peek(); - let full_name = format!("{} {}", first_name, last_name).trim().to_string(); + let full_name = format!("{first_name} {last_name}").trim().to_string(); Ok(Secret::new(full_name)) } @@ -2401,7 +2401,7 @@ pub fn is_mandate_supported( } else { match payment_method_type { Some(pm_type) => Err(errors::ConnectorError::NotSupported { - message: format!("{} mandate payment", pm_type), + message: format!("{pm_type} mandate payment"), connector, } .into()), @@ -2775,7 +2775,7 @@ impl NetworkTokenData for domain::NetworkTokenData { fn get_expiry_year_4_digit(&self) -> Secret { let mut year = self.token_exp_year.peek().clone(); if year.len() == 2 { - year = format!("20{}", year); + year = format!("20{year}"); } Secret::new(year) } @@ -2784,7 +2784,7 @@ impl NetworkTokenData for domain::NetworkTokenData { fn get_expiry_year_4_digit(&self) -> Secret { let mut year = self.network_token_exp_year.peek().clone(); if year.len() == 2 { - year = format!("20{}", year); + year = format!("20{year}"); } Secret::new(year) } diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index eeb4557daf..dcb947784b 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -1346,7 +1346,7 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> { } errors::ConnectorError::InvalidConnectorConfig { config: field_name } => err .change_context(errors::ApiErrorResponse::InvalidRequestData { - message: format!("The {} is invalid", field_name), + message: format!("The {field_name} is invalid"), }), errors::ConnectorError::FailedToObtainAuthType => { err.change_context(errors::ApiErrorResponse::InvalidRequestData { @@ -1823,7 +1823,7 @@ impl ConnectorAuthTypeValidation<'_> { let validate_non_empty_field = |field_value: &str, field_name: &str| { if field_value.trim().is_empty() { Err(errors::ApiErrorResponse::InvalidDataFormat { - field_name: format!("connector_account_details.{}", field_name), + field_name: format!("connector_account_details.{field_name}"), expected_format: "a non empty String".to_string(), } .into()) @@ -2668,7 +2668,7 @@ trait MerchantConnectorAccountCreateBridge { ) -> RouterResult; } -#[cfg(all(feature = "v2", feature = "olap",))] +#[cfg(all(feature = "v2", feature = "olap"))] #[async_trait::async_trait] impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { async fn create_domain_model_from_request( @@ -3480,8 +3480,8 @@ pub async fn update_connector( ) .attach_printable_lazy(|| { format!( - "Failed while updating MerchantConnectorAccount: id: {:?}", - merchant_connector_id + "Failed while updating MerchantConnectorAccount: id: {merchant_connector_id:?}", + ) })?; diff --git a/crates/router/src/core/authentication/utils.rs b/crates/router/src/core/authentication/utils.rs index 57096aa83e..0466205ca0 100644 --- a/crates/router/src/core/authentication/utils.rs +++ b/crates/router/src/core/authentication/utils.rs @@ -238,7 +238,7 @@ pub async fn create_new_authentication( merchant_id, authentication_connector: Some(authentication_connector), connector_authentication_id: None, - payment_method_id: format!("eph_{}", token), + payment_method_id: format!("eph_{token}"), authentication_type: None, authentication_status: common_enums::AuthenticationStatus::Started, authentication_lifecycle_status: common_enums::AuthenticationLifecycleStatus::Unused, diff --git a/crates/router/src/core/errors/user.rs b/crates/router/src/core/errors/user.rs index 4b19cbb034..4488ea2af4 100644 --- a/crates/router/src/core/errors/user.rs +++ b/crates/router/src/core/errors/user.rs @@ -362,17 +362,17 @@ impl UserErrors { Self::ThemeNotFound => "Theme not found".to_string(), Self::ThemeAlreadyExists => "Theme with lineage already exists".to_string(), Self::InvalidThemeLineage(field_name) => { - format!("Invalid field: {} in lineage", field_name) + format!("Invalid field: {field_name} in lineage") } Self::MissingEmailConfig => "Missing required field: email_config".to_string(), Self::InvalidAuthMethodOperationWithMessage(operation) => { - format!("Invalid Auth Method Operation: {}", operation) + format!("Invalid Auth Method Operation: {operation}") } Self::InvalidCloneConnectorOperation(operation) => { - format!("Invalid Clone Connector Operation: {}", operation) + format!("Invalid Clone Connector Operation: {operation}") } Self::ErrorCloningConnector(error_message) => { - format!("Error cloning connector: {}", error_message) + format!("Error cloning connector: {error_message}") } } } diff --git a/crates/router/src/core/errors/utils.rs b/crates/router/src/core/errors/utils.rs index 53ea2e83fd..29f2023b9a 100644 --- a/crates/router/src/core/errors/utils.rs +++ b/crates/router/src/core/errors/utils.rs @@ -468,7 +468,7 @@ impl ConnectorErrorExt for error_stack::Result } errors::ConnectorError::NotSupported { message, connector } => { errors::ApiErrorResponse::NotSupported { - message: format!("{} by {}", message, connector), + message: format!("{message} by {connector}"), } } errors::ConnectorError::NotImplemented(reason) => { @@ -504,7 +504,7 @@ impl ConnectorErrorExt for error_stack::Result } errors::ConnectorError::NotSupported { message, connector } => { errors::ApiErrorResponse::NotSupported { - message: format!("{} by {}", message, connector), + message: format!("{message} by {connector}"), } } errors::ConnectorError::NotImplemented(reason) => { @@ -546,7 +546,7 @@ impl RedisErrorExt for error_stack::Report { fn to_redis_failed_response(self, key: &str) -> error_stack::Report { match self.current_context() { errors::RedisError::NotFound => self.change_context( - errors::StorageError::ValueNotFound(format!("Data does not exist for key {key}",)), + errors::StorageError::ValueNotFound(format!("Data does not exist for key {key}")), ), errors::RedisError::SetNxFailed => { self.change_context(errors::StorageError::DuplicateValue { diff --git a/crates/router/src/core/files.rs b/crates/router/src/core/files.rs index d27cfaa9a0..2a22414f64 100644 --- a/crates/router/src/core/files.rs +++ b/crates/router/src/core/files.rs @@ -75,7 +75,7 @@ pub async fn files_create_core( .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable_lazy(|| { - format!("Unable to update file_metadata with file_id: {}", file_id) + format!("Unable to update file_metadata with file_id: {file_id}") })?; Ok(ApplicationResponse::Json(files::CreateFileResponse { file_id, diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rs index 923a7af9da..202bb7db9e 100644 --- a/crates/router/src/core/payment_link.rs +++ b/crates/router/src/core/payment_link.rs @@ -394,7 +394,7 @@ pub async fn initiate_secure_payment_link_flow( .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to serialize PaymentLinkData")?; let url_encoded_str = urlencoding::encode(&payment_details_str); - let js_script = format!("window.__PAYMENT_DETAILS = '{}';", url_encoded_str); + let js_script = format!("window.__PAYMENT_DETAILS = '{url_encoded_str}';"); let html_meta_tags = get_meta_tags_html(&link_details); let payment_link_data = services::PaymentLinkFormData { js_script, @@ -570,7 +570,7 @@ fn get_payment_link_css_script( let color_scheme_css = get_color_scheme_css(payment_link_config); if let Some(custom_rules_css) = custom_rules_css_option { - Ok(format!("{}\n{}", color_scheme_css, custom_rules_css)) + Ok(format!("{color_scheme_css}\n{custom_rules_css}")) } else { Ok(color_scheme_css) } @@ -725,7 +725,7 @@ pub fn get_payment_link_config_based_on_priority( .clone() .map(|d_name| { logger::info!("domain name set to custom domain https://{:?}", d_name); - format!("https://{}", d_name) + format!("https://{d_name}") }) .unwrap_or_else(|| default_domain_name.clone()), payment_link_config_id diff --git a/crates/router/src/core/payment_link/validator.rs b/crates/router/src/core/payment_link/validator.rs index 0968c8301a..7567cbf63c 100644 --- a/crates/router/src/core/payment_link/validator.rs +++ b/crates/router/src/core/payment_link/validator.rs @@ -20,21 +20,13 @@ pub fn validate_secure_payment_link_render_request( .clone() .ok_or(report!(errors::ApiErrorResponse::InvalidRequestUrl)) .attach_printable_lazy(|| { - format!( - "Secure payment link was not generated for {}\nmissing allowed_domains", - link_id - ) + format!("Secure payment link was not generated for {link_id}\nmissing allowed_domains") })?; // Validate secure_link was generated if payment_link.secure_link.clone().is_none() { return Err(report!(errors::ApiErrorResponse::InvalidRequestUrl)).attach_printable_lazy( - || { - format!( - "Secure payment link was not generated for {}\nmissing secure_link", - link_id - ) - }, + || format!("Secure payment link was not generated for {link_id}\nmissing secure_link"), ); } @@ -46,8 +38,8 @@ pub fn validate_secure_payment_link_render_request( })) .attach_printable_lazy(|| { format!( - "Access to payment_link [{}] is forbidden when requested through {}", - link_id, requestor + "Access to payment_link [{link_id}] is forbidden when requested through {requestor}", + ) }), None => Err(report!(errors::ApiErrorResponse::AccessForbidden { @@ -55,8 +47,8 @@ pub fn validate_secure_payment_link_render_request( })) .attach_printable_lazy(|| { format!( - "Access to payment_link [{}] is forbidden when sec-fetch-dest is not present in request headers", - link_id + "Access to payment_link [{link_id}] is forbidden when sec-fetch-dest is not present in request headers", + ) }), }?; @@ -74,8 +66,8 @@ pub fn validate_secure_payment_link_render_request( }) .attach_printable_lazy(|| { format!( - "Access to payment_link [{}] is forbidden when origin or referer is not present in request headers", - link_id + "Access to payment_link [{link_id}] is forbidden when origin or referer is not present in request headers", + ) })?; @@ -86,11 +78,11 @@ pub fn validate_secure_payment_link_render_request( }) }) .attach_printable_lazy(|| { - format!("Invalid URL found in request headers {}", origin_or_referer) + format!("Invalid URL found in request headers {origin_or_referer}") })?; url.host_str() - .and_then(|host| url.port().map(|port| format!("{}:{}", host, port))) + .and_then(|host| url.port().map(|port| format!("{host}:{port}"))) .or_else(|| url.host_str().map(String::from)) .ok_or_else(|| { report!(errors::ApiErrorResponse::AccessForbidden { @@ -98,7 +90,7 @@ pub fn validate_secure_payment_link_render_request( }) }) .attach_printable_lazy(|| { - format!("host or port not found in request headers {:?}", url) + format!("host or port not found in request headers {url:?}") })? }; @@ -110,8 +102,7 @@ pub fn validate_secure_payment_link_render_request( })) .attach_printable_lazy(|| { format!( - "Access to payment_link [{}] is forbidden from requestor - {}", - link_id, domain_in_req + "Access to payment_link [{link_id}] is forbidden from requestor - {domain_in_req}", ) }) } diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs index 2034119fa2..6d36f7d434 100644 --- a/crates/router/src/core/payment_methods.rs +++ b/crates/router/src/core/payment_methods.rs @@ -231,7 +231,7 @@ pub async fn initiate_pm_collect_link( link: url::Url::parse(url) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable_lazy(|| { - format!("Failed to parse the payment method collect link - {}", url) + format!("Failed to parse the payment method collect link - {url}") })? .into(), return_url: pm_collect_link.return_url, diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index 11b1489b5c..c308d30e24 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -419,8 +419,7 @@ impl PaymentMethodsController for PmCards<'_> { .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable(format!( - "Failed to fetch payment method for existing pm_id: {:?} in db", - pm_id + "Failed to fetch payment method for existing pm_id: {pm_id:?} in db", ))?; db.update_payment_method( @@ -433,8 +432,7 @@ impl PaymentMethodsController for PmCards<'_> { .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable(format!( - "Failed to update payment method for existing pm_id: {:?} in db", - pm_id + "Failed to update payment method for existing pm_id: {pm_id:?} in db", ))?; logger::debug!("Network token added to locker and payment method updated"); diff --git a/crates/router/src/core/payment_methods/tokenize.rs b/crates/router/src/core/payment_methods/tokenize.rs index 98eca478c9..3556673510 100644 --- a/crates/router/src/core/payment_methods/tokenize.rs +++ b/crates/router/src/core/payment_methods/tokenize.rs @@ -371,8 +371,7 @@ where } else { Err(report!(errors::ApiErrorResponse::NotSupported { message: format!( - "Network tokenization for {} is not supported", - card_network + "Network tokenization for {card_network} is not supported", ) })) } diff --git a/crates/router/src/core/payment_methods/validator.rs b/crates/router/src/core/payment_methods/validator.rs index 760d60a6b2..69d908c157 100644 --- a/crates/router/src/core/payment_methods/validator.rs +++ b/crates/router/src/core/payment_methods/validator.rs @@ -113,7 +113,7 @@ pub async fn validate_request_and_initiate_payment_method_collect_link( let domain = merchant_config .clone() .and_then(|c| c.config.domain_name) - .map(|domain| format!("https://{}", domain)) + .map(|domain| format!("https://{domain}")) .unwrap_or(state.base_url.clone()); let session_expiry = match req.session_expiry { Some(expiry) => expiry, diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index 83176881ea..d87f0e8dcb 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -4379,7 +4379,7 @@ where )))) } TokenizationAction::ConnectorToken(_) => { - logger::info!("Invalid tokenization action found for decryption flow: ConnectorToken",); + logger::info!("Invalid tokenization action found for decryption flow: ConnectorToken"); Ok(None) } token_action => { diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs index 318e69d7ac..ace3588c22 100644 --- a/crates/router/src/core/payments/flows/authorize_flow.rs +++ b/crates/router/src/core/payments/flows/authorize_flow.rs @@ -771,8 +771,7 @@ async fn create_order_at_connector( } else { Err(error_stack::report!(ApiErrorResponse::InternalServerError) .attach_printable(format!( - "Unexpected response format from connector: {:?}", - res + "Unexpected response format from connector: {res:?}", )))? } } diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index 6db9510292..4b7791bb08 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -1017,7 +1017,7 @@ pub fn validate_card_expiry( let mut year_str = card_exp_year.peek().to_string(); if year_str.len() == 2 { - year_str = format!("20{}", year_str); + year_str = format!("20{year_str}"); } let exp_year = year_str @@ -1197,7 +1197,7 @@ pub fn create_redirect_url( connector_name: impl std::fmt::Display, creds_identifier: Option<&str>, ) -> String { - let creds_identifier_path = creds_identifier.map_or_else(String::new, |cd| format!("/{}", cd)); + let creds_identifier_path = creds_identifier.map_or_else(String::new, |cd| format!("/{cd}")); format!( "{}/payments/{}/{}/redirect/response/{}", router_base_url, @@ -1251,7 +1251,7 @@ pub fn create_complete_authorize_url( creds_identifier: Option<&str>, ) -> String { let creds_identifier = creds_identifier.map_or_else(String::new, |creds_identifier| { - format!("/{}", creds_identifier) + format!("/{creds_identifier}") }); format!( "{}/payments/{}/{}/redirect/complete/{}{}", @@ -3020,10 +3020,7 @@ pub(super) fn validate_payment_list_request( req.limit > PAYMENTS_LIST_MAX_LIMIT_V1 || req.limit < 1, || { Err(errors::ApiErrorResponse::InvalidRequestData { - message: format!( - "limit should be in between 1 and {}", - PAYMENTS_LIST_MAX_LIMIT_V1 - ), + message: format!("limit should be in between 1 and {PAYMENTS_LIST_MAX_LIMIT_V1}"), }) }, )?; @@ -3037,10 +3034,7 @@ pub(super) fn validate_payment_list_request_for_joins( utils::when(!(1..=PAYMENTS_LIST_MAX_LIMIT_V2).contains(&limit), || { Err(errors::ApiErrorResponse::InvalidRequestData { - message: format!( - "limit should be in between 1 and {}", - PAYMENTS_LIST_MAX_LIMIT_V2 - ), + message: format!("limit should be in between 1 and {PAYMENTS_LIST_MAX_LIMIT_V2}"), }) })?; Ok(()) @@ -6985,8 +6979,8 @@ pub async fn validate_merchant_connector_ids_in_connector_mandate_details( ], }) .attach_printable(format!( - "Invalid connector_mandate_details provided for connector {:?}", - migrating_merchant_connector_id + "Invalid connector_mandate_details provided for connector {migrating_merchant_connector_id:?}", + ))? } } @@ -6996,8 +6990,8 @@ pub async fn validate_merchant_connector_ids_in_connector_mandate_details( }) .attach_printable_lazy(|| { format!( - "{:?} invalid merchant connector id in connector_mandate_details", - migrating_merchant_connector_id + "{migrating_merchant_connector_id:?} invalid merchant connector id in connector_mandate_details", + ) })?, } @@ -7301,8 +7295,8 @@ pub async fn validate_allowed_payment_method_types_request( || { Err(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration) .attach_printable(format!( - "None of the allowed payment method types {:?} are configured for this merchant connector account.", - allowed_payment_method_types + "None of the allowed payment method types {allowed_payment_method_types:?} are configured for this merchant connector account.", + )) }, )?; diff --git a/crates/router/src/core/payments/routing/utils.rs b/crates/router/src/core/payments/routing/utils.rs index 0b74273419..bef71d5fc6 100644 --- a/crates/router/src/core/payments/routing/utils.rs +++ b/crates/router/src/core/payments/routing/utils.rs @@ -71,7 +71,7 @@ where ErrRes: serde::de::DeserializeOwned + std::fmt::Debug + Clone + DecisionEngineErrorsInterface, { let decision_engine_base_url = &state.conf.open_router.url; - let url = format!("{}/{}", decision_engine_base_url, path); + let url = format!("{decision_engine_base_url}/{path}"); logger::debug!(decision_engine_api_call_url = %url, decision_engine_request_path = %path, http_method = ?http_method, "decision_engine: Initiating decision_engine API call ({})", context_message); let mut request_builder = services::RequestBuilder::new() diff --git a/crates/router/src/core/payments/types.rs b/crates/router/src/core/payments/types.rs index 29d87944ea..df95cc6182 100644 --- a/crates/router/src/core/payments/types.rs +++ b/crates/router/src/core/payments/types.rs @@ -269,7 +269,7 @@ impl SurchargeMetadata { self.surcharge_results.get(&surcharge_key) } pub fn get_surcharge_metadata_redis_key(payment_attempt_id: &str) -> String { - format!("surcharge_metadata_{}", payment_attempt_id) + format!("surcharge_metadata_{payment_attempt_id}") } pub fn get_individual_surcharge_key_value_pairs(&self) -> Vec<(String, SurchargeDetails)> { self.surcharge_results @@ -283,16 +283,13 @@ impl SurchargeMetadata { pub fn get_surcharge_details_redis_hashset_key(surcharge_key: &SurchargeKey) -> String { match surcharge_key { SurchargeKey::Token(token) => { - format!("token_{}", token) + format!("token_{token}") } SurchargeKey::PaymentMethodData(payment_method, payment_method_type, card_network) => { if let Some(card_network) = card_network { - format!( - "{}_{}_{}", - payment_method, payment_method_type, card_network - ) + format!("{payment_method}_{payment_method_type}_{card_network}") } else { - format!("{}_{}", payment_method, payment_method_type) + format!("{payment_method}_{payment_method_type}") } } } diff --git a/crates/router/src/core/payout_link.rs b/crates/router/src/core/payout_link.rs index 1d224ffbd7..e96e1229e4 100644 --- a/crates/router/src/core/payout_link.rs +++ b/crates/router/src/core/payout_link.rs @@ -151,7 +151,7 @@ pub async fn initiate_payout_link( customer_id, payout_link.link_id ), }) - .attach_printable_lazy(|| format!("customer [{:?}] not found", customer_id))?; + .attach_printable_lazy(|| format!("customer [{customer_id:?}] not found"))?; let address = payout .address_id .as_ref() diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs index 3cc996bd9a..66c87086c7 100644 --- a/crates/router/src/core/payouts.rs +++ b/crates/router/src/core/payouts.rs @@ -450,10 +450,7 @@ pub async fn payouts_update_core( // Verify update feasibility if helpers::is_payout_terminal_state(status) || helpers::is_payout_initiated(status) { return Err(report!(errors::ApiErrorResponse::InvalidRequestData { - message: format!( - "Payout {:?} cannot be updated for status {}", - payout_id, status - ), + message: format!("Payout {payout_id:?} cannot be updated for status {status}"), })); } helpers::update_payouts_and_payout_attempt(&mut payout_data, &merchant_context, &req, &state) @@ -788,8 +785,7 @@ pub async fn payouts_list_core( .await .map_err(|err| { let err_msg = format!( - "failed while fetching customer for customer_id - {:?}", - customer_id + "failed while fetching customer for customer_id - {customer_id:?}", ); logger::warn!(?err, err_msg); }) @@ -961,8 +957,8 @@ pub async fn payouts_filtered_list_core( .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable_lazy(|| { format!( - "Failed to fetch total count of filtered payouts for the given constraints - {:?}", - filters + "Failed to fetch total count of filtered payouts for the given constraints - {filters:?}", + ) })?; @@ -2915,8 +2911,7 @@ pub async fn make_payout_data( .map_err(|err| err.change_context(errors::ApiErrorResponse::InternalServerError)) .attach_printable_lazy(|| { format!( - "Failed while fetching optional customer [id - {:?}] for payout [id - {:?}]", - customer_id, payout_id + "Failed while fetching optional customer [id - {customer_id:?}] for payout [id - {payout_id:?}]" ) }) }) @@ -3177,7 +3172,7 @@ pub async fn create_payout_link( let base_url = profile_config .as_ref() .and_then(|c| c.config.domain_name.as_ref()) - .map(|domain| format!("https://{}", domain)) + .map(|domain| format!("https://{domain}")) .unwrap_or(state.base_url.clone()); let session_expiry = req .session_expiry @@ -3190,7 +3185,7 @@ pub async fn create_payout_link( ); let link = url::Url::parse(&url) .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable_lazy(|| format!("Failed to form payout link URL - {}", url))?; + .attach_printable_lazy(|| format!("Failed to form payout link URL - {url}"))?; let req_enabled_payment_methods = payout_link_config_req .as_ref() .and_then(|req| req.enabled_payment_methods.to_owned()); diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs index 9e006ed9ce..f1f8dad3a0 100644 --- a/crates/router/src/core/payouts/helpers.rs +++ b/crates/router/src/core/payouts/helpers.rs @@ -823,14 +823,13 @@ pub(super) async fn get_or_create_customer_details( .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable_lazy(|| { format!( - "Failed to insert customer [id - {:?}] for merchant [id - {:?}]", - customer_id, merchant_id + "Failed to insert customer [id - {customer_id:?}] for merchant [id - {merchant_id:?}]", ) })?, )) } else { Err(report!(errors::ApiErrorResponse::InvalidRequestData { - message: format!("customer for id - {:?} not found", customer_id), + message: format!("customer for id - {customer_id:?} not found"), })) } } @@ -1200,9 +1199,8 @@ pub async fn update_payouts_and_payout_attempt( if is_payout_terminal_state(status) || is_payout_initiated(status) { return Err(report!(errors::ApiErrorResponse::InvalidRequestData { message: format!( - "Payout {} cannot be updated for status {}", - payout_id.get_string_repr(), - status + "Payout {} cannot be updated for status {status}", + payout_id.get_string_repr() ), })); } diff --git a/crates/router/src/core/payouts/validator.rs b/crates/router/src/core/payouts/validator.rs index 1af3f4d2cb..3d58d1f367 100644 --- a/crates/router/src/core/payouts/validator.rs +++ b/crates/router/src/core/payouts/validator.rs @@ -118,8 +118,7 @@ pub async fn validate_create_request( .await .attach_printable_lazy(|| { format!( - "Unique violation while checking payout_id: {:?} against merchant_id: {:?}", - payout_id, merchant_id + "Unique violation while checking payout_id: {payout_id:?} against merchant_id: {merchant_id:?}" ) })? { Some(_) => Err(report!(errors::ApiErrorResponse::DuplicatePayout { @@ -293,10 +292,7 @@ pub(super) fn validate_payout_list_request( req.limit > PAYOUTS_LIST_MAX_LIMIT_GET || req.limit < 1, || { Err(errors::ApiErrorResponse::InvalidRequestData { - message: format!( - "limit should be in between 1 and {}", - PAYOUTS_LIST_MAX_LIMIT_GET - ), + message: format!("limit should be in between 1 and {PAYOUTS_LIST_MAX_LIMIT_GET}"), }) }, )?; @@ -311,10 +307,7 @@ pub(super) fn validate_payout_list_request_for_joins( utils::when(!(1..=PAYOUTS_LIST_MAX_LIMIT_POST).contains(&limit), || { Err(errors::ApiErrorResponse::InvalidRequestData { - message: format!( - "limit should be in between 1 and {}", - PAYOUTS_LIST_MAX_LIMIT_POST - ), + message: format!("limit should be in between 1 and {PAYOUTS_LIST_MAX_LIMIT_POST}"), }) })?; Ok(()) @@ -347,8 +340,8 @@ pub fn validate_payout_link_render_request_and_get_allowed_domains( })) .attach_printable_lazy(|| { format!( - "Access to payout_link [{}] is forbidden when requested through {}", - link_id, requestor + "Access to payout_link [{link_id}] is forbidden when requested through {requestor}", + ) }), None => Err(report!(errors::ApiErrorResponse::AccessForbidden { @@ -356,8 +349,8 @@ pub fn validate_payout_link_render_request_and_get_allowed_domains( })) .attach_printable_lazy(|| { format!( - "Access to payout_link [{}] is forbidden when sec-fetch-dest is not present in request headers", - link_id + "Access to payout_link [{link_id}] is forbidden when sec-fetch-dest is not present in request headers", + ) }), }?; @@ -375,8 +368,8 @@ pub fn validate_payout_link_render_request_and_get_allowed_domains( }) .attach_printable_lazy(|| { format!( - "Access to payout_link [{}] is forbidden when origin or referer is not present in request headers", - link_id + "Access to payout_link [{link_id}] is forbidden when origin or referer is not present in request headers", + ) })?; @@ -387,11 +380,11 @@ pub fn validate_payout_link_render_request_and_get_allowed_domains( }) }) .attach_printable_lazy(|| { - format!("Invalid URL found in request headers {}", origin_or_referer) + format!("Invalid URL found in request headers {origin_or_referer}") })?; url.host_str() - .and_then(|host| url.port().map(|port| format!("{}:{}", host, port))) + .and_then(|host| url.port().map(|port| format!("{host}:{port}"))) .or_else(|| url.host_str().map(String::from)) .ok_or_else(|| { report!(errors::ApiErrorResponse::AccessForbidden { @@ -399,7 +392,7 @@ pub fn validate_payout_link_render_request_and_get_allowed_domains( }) }) .attach_printable_lazy(|| { - format!("host or port not found in request headers {:?}", url) + format!("host or port not found in request headers {url:?}") })? }; @@ -414,8 +407,8 @@ pub fn validate_payout_link_render_request_and_get_allowed_domains( })) .attach_printable_lazy(|| { format!( - "Access to payout_link [{}] is forbidden from requestor - {}", - link_id, domain_in_req + "Access to payout_link [{link_id}] is forbidden from requestor - {domain_in_req}", + ) }) } diff --git a/crates/router/src/core/proxy.rs b/crates/router/src/core/proxy.rs index 545c2ef9cc..afea3fb6ac 100644 --- a/crates/router/src/core/proxy.rs +++ b/crates/router/src/core/proxy.rs @@ -91,7 +91,7 @@ fn extract_field_from_vault_data(vault_data: &Value, field_name: &str) -> Router match vault_data { Value::Object(obj) => find_field_recursively_in_vault_data(obj, field_name) .ok_or_else(|| errors::ApiErrorResponse::InternalServerError) - .attach_printable(format!("Field '{}' not found", field_name)), + .attach_printable(format!("Field '{field_name}' not found")), _ => Err(errors::ApiErrorResponse::InternalServerError) .attach_printable("Vault data is not a valid JSON object"), } diff --git a/crates/router/src/core/recon.rs b/crates/router/src/core/recon.rs index 16418ad83a..1e816a9613 100644 --- a/crates/router/src/core/recon.rs +++ b/crates/router/src/core/recon.rs @@ -49,8 +49,7 @@ pub async fn send_recon_request( .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable(format!( - "Failed to fetch theme for merchant_id = {:?}", - merchant_id + "Failed to fetch theme for merchant_id = {merchant_id:?}", ))?; let user_email = user_in_db.email.clone(); @@ -189,8 +188,7 @@ pub async fn recon_merchant_account_update( .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable(format!( - "Failed to fetch theme for merchant_id = {:?}", - merchant_id + "Failed to fetch theme for merchant_id = {merchant_id:?}", ))?; let email_contents = email_types::ReconActivation { diff --git a/crates/router/src/core/revenue_recovery/types.rs b/crates/router/src/core/revenue_recovery/types.rs index 6d66a8b500..8a13c32b51 100644 --- a/crates/router/src/core/revenue_recovery/types.rs +++ b/crates/router/src/core/revenue_recovery/types.rs @@ -786,8 +786,7 @@ pub fn construct_recovery_record_back_router_data( ) .change_context(errors::RecoveryError::RecordBackToBillingConnectorFailed) .attach_printable(format!( - "cannot find connector params for this connector {} in this flow", - connector + "cannot find connector params for this connector {connector} in this flow", ))?; let router_data = router_data_v2::RouterDataV2 { diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs index 0d34986c83..ffd5f60e79 100644 --- a/crates/router/src/core/routing.rs +++ b/crates/router/src/core/routing.rs @@ -2518,7 +2518,7 @@ pub async fn migrate_rules_for_profile( Ok(algo) => algo, Err(e) => { router_env::logger::error!(?e, ?algorithm_id, "Failed to fetch routing algorithm"); - push_error(algorithm_id, format!("Fetch error: {:?}", e)); + push_error(algorithm_id, format!("Fetch error: {e:?}")); continue; } }; @@ -2536,7 +2536,7 @@ pub async fn migrate_rules_for_profile( ?algorithm_id, "Failed to convert advanced program" ); - push_error(algorithm_id.clone(), format!("Conversion error: {:?}", e)); + push_error(algorithm_id.clone(), format!("Conversion error: {e:?}")); None } }, @@ -2559,7 +2559,7 @@ pub async fn migrate_rules_for_profile( } Err(e) => { router_env::logger::error!(?e, ?algorithm_id, "Failed to parse algorithm"); - push_error(algorithm_id.clone(), format!("Parse error: {:?}", e)); + push_error(algorithm_id.clone(), format!("Parse error: {e:?}")); None } }; @@ -2611,7 +2611,7 @@ pub async fn migrate_rules_for_profile( ); push_error( algorithm.algorithm_id.clone(), - format!("Insertion error: {:?}", err), + format!("Insertion error: {err:?}"), ); } } diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs index 6d263eece2..df9c11efe4 100644 --- a/crates/router/src/core/routing/helpers.rs +++ b/crates/router/src/core/routing/helpers.rs @@ -393,9 +393,7 @@ impl RoutingAlgorithmHelpers<'_> { self.name_mca_id_set.0.contains(&(&connector_choice, mca_id.clone())), errors::ApiErrorResponse::InvalidRequestData { message: format!( - "connector with name '{}' and merchant connector account id '{:?}' not found for the given profile", - connector_choice, - mca_id, + "connector with name '{connector_choice}' and merchant connector account id '{mca_id:?}' not found for the given profile", ) } ); @@ -405,8 +403,7 @@ impl RoutingAlgorithmHelpers<'_> { self.name_set.0.contains(&connector_choice), errors::ApiErrorResponse::InvalidRequestData { message: format!( - "connector with name '{}' not found for the given profile", - connector_choice, + "connector with name '{connector_choice}' not found for the given profile", ) } ); @@ -1605,8 +1602,8 @@ pub async fn push_metrics_with_update_window_for_contract_based_routing( .split_once(':') .ok_or(errors::ApiErrorResponse::InternalServerError) .attach_printable(format!( - "unable to split connector_name and mca_id from the first connector {:?} obtained from dynamic routing service", - first_contract_based_connector + "unable to split connector_name and mca_id from the first connector {first_contract_based_connector:?} obtained from dynamic routing service", + ))? .0, first_contract_based_connector.score, first_contract_based_connector.current_count ); diff --git a/crates/router/src/core/user_role/role.rs b/crates/router/src/core/user_role/role.rs index 6a1cc3738e..554c0cd7a2 100644 --- a/crates/router/src/core/user_role/role.rs +++ b/crates/router/src/core/user_role/role.rs @@ -82,16 +82,16 @@ pub async fn create_role( if requestor_entity_from_role_scope < role_entity_type { return Err(report!(UserErrors::InvalidRoleOperation)).attach_printable(format!( - "User is trying to create role of type {} and scope {}", - role_entity_type, requestor_entity_from_role_scope + "User is trying to create role of type {role_entity_type} and scope {requestor_entity_from_role_scope}", + )); } let max_from_scope_and_entity = cmp::max(requestor_entity_from_role_scope, role_entity_type); if user_entity_type < max_from_scope_and_entity { return Err(report!(UserErrors::InvalidRoleOperation)).attach_printable(format!( - "{} is trying to create of scope {} and of type {}", - user_entity_type, requestor_entity_from_role_scope, role_entity_type + "{user_entity_type} is trying to create of scope {requestor_entity_from_role_scope} and of type {role_entity_type}", + )); } @@ -345,10 +345,7 @@ pub async fn list_roles_with_info( .into()); } - let mut role_info_vec = PREDEFINED_ROLES - .iter() - .map(|(_, role_info)| role_info.clone()) - .collect::>(); + let mut role_info_vec = PREDEFINED_ROLES.values().cloned().collect::>(); let user_role_entity = user_role_info.get_entity_type(); let is_lineage_data_required = request.entity_type.is_none(); @@ -439,10 +436,7 @@ pub async fn list_roles_at_entity_level( ) .into()); } - let mut role_info_vec = PREDEFINED_ROLES - .iter() - .map(|(_, role_info)| role_info.clone()) - .collect::>(); + let mut role_info_vec = PREDEFINED_ROLES.values().cloned().collect::>(); let tenant_id = user_from_token .tenant_id diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs index d0a27406eb..d1d298bd17 100644 --- a/crates/router/src/core/utils.rs +++ b/crates/router/src/core/utils.rs @@ -2023,7 +2023,7 @@ pub(crate) fn validate_profile_id_from_auth_layer Ok(()), } } @@ -2145,7 +2145,7 @@ fn validate_iban(iban: &Secret) -> RouterResult<()> { rearranged_iban.chars().for_each(|c| { if c.is_ascii_uppercase() { let digit = (u32::from(c) - u32::from('A')) + 10; - result.push_str(&format!("{:02}", digit)); + result.push_str(&format!("{digit:02}")); } else { result.push(c); } diff --git a/crates/router/src/core/utils/refunds_validator.rs b/crates/router/src/core/utils/refunds_validator.rs index e251ad12cf..8d532b2c70 100644 --- a/crates/router/src/core/utils/refunds_validator.rs +++ b/crates/router/src/core/utils/refunds_validator.rs @@ -245,8 +245,8 @@ pub fn validate_adyen_charge_refund( if refund_amount > payment_amount { return Err(report!(errors::ApiErrorResponse::InvalidRequestData { message: format!( - "Invalid refund amount for split item, reference: {}", - refund_split_reference + "Invalid refund amount for split item, reference: {refund_split_reference}", + ), })); } @@ -260,8 +260,8 @@ pub fn validate_adyen_charge_refund( if !refund_account.eq(payment_account) { return Err(report!(errors::ApiErrorResponse::InvalidRequestData { message: format!( - "Invalid refund account for split item, reference: {}", - refund_split_reference + "Invalid refund account for split item, reference: {refund_split_reference}", + ), })); } @@ -270,16 +270,15 @@ pub fn validate_adyen_charge_refund( if refund_split_item.split_type != payment_split_item.split_type { return Err(report!(errors::ApiErrorResponse::InvalidRequestData { message: format!( - "Invalid refund split_type for split item, reference: {}", - refund_split_reference + "Invalid refund split_type for split item, reference: {refund_split_reference}", + ), })); } } else { return Err(report!(errors::ApiErrorResponse::InvalidRequestData { message: format!( - "No matching payment split item found for reference: {}", - refund_split_reference + "No matching payment split item found for reference: {refund_split_reference}", ), })); } diff --git a/crates/router/src/core/verification/utils.rs b/crates/router/src/core/verification/utils.rs index 4967f08bcb..81b916206a 100644 --- a/crates/router/src/core/verification/utils.rs +++ b/crates/router/src/core/verification/utils.rs @@ -112,8 +112,8 @@ pub async fn check_existence_and_add_domain_to_db( .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable_lazy(|| { format!( - "Failed while updating MerchantConnectorAccount: id: {:?}", - merchant_connector_id + "Failed while updating MerchantConnectorAccount: id: {merchant_connector_id:?}", + ) })?; diff --git a/crates/router/src/core/webhooks/recovery_incoming.rs b/crates/router/src/core/webhooks/recovery_incoming.rs index f13caeefb7..791a683ed4 100644 --- a/crates/router/src/core/webhooks/recovery_incoming.rs +++ b/crates/router/src/core/webhooks/recovery_incoming.rs @@ -983,8 +983,7 @@ impl BillingConnectorPaymentsSyncFlowRouterData { ) .change_context(errors::RevenueRecoveryError::BillingConnectorPaymentsSyncFailed) .attach_printable(format!( - "cannot find connector params for this connector {} in this flow", - connector + "cannot find connector params for this connector {connector} in this flow", ))?; let router_data = types::RouterDataV2 { @@ -1150,8 +1149,7 @@ impl BillingConnectorInvoiceSyncFlowRouterData { ) .change_context(errors::RevenueRecoveryError::BillingConnectorPaymentsSyncFailed) .attach_printable(format!( - "cannot find connector params for this connector {} in this flow", - connector + "cannot find connector params for this connector {connector} in this flow", ))?; let router_data = types::RouterDataV2 { diff --git a/crates/router/src/db/address.rs b/crates/router/src/db/address.rs index 2e2bb7dccb..048645dd46 100644 --- a/crates/router/src/db/address.rs +++ b/crates/router/src/db/address.rs @@ -388,7 +388,7 @@ mod storage { merchant_id, payment_id, }; - let field = format!("add_{}", address_id); + let field = format!("add_{address_id}"); Box::pin(db_utils::try_redis_get_else_try_database_get( async { Box::pin(kv_wrapper( diff --git a/crates/router/src/db/mandate.rs b/crates/router/src/db/mandate.rs index 1eb0357ab0..1d1d712de1 100644 --- a/crates/router/src/db/mandate.rs +++ b/crates/router/src/db/mandate.rs @@ -110,7 +110,7 @@ mod storage { merchant_id, mandate_id, }; - let field = format!("mandate_{}", mandate_id); + let field = format!("mandate_{mandate_id}"); Box::pin(db_utils::try_redis_get_else_try_database_get( async { @@ -225,7 +225,7 @@ mod storage { merchant_id, mandate_id, }; - let field = format!("mandate_{}", mandate_id); + let field = format!("mandate_{mandate_id}"); let storage_scheme = Box::pin(decide_storage_scheme::<_, diesel_models::Mandate>( self, storage_scheme, @@ -342,7 +342,7 @@ mod storage { mandate_id: mandate_id.as_str(), }; let key_str = key.to_string(); - let field = format!("mandate_{}", mandate_id); + let field = format!("mandate_{mandate_id}"); let storage_mandate = storage_types::Mandate::from(&mandate); diff --git a/crates/router/src/db/merchant_account.rs b/crates/router/src/db/merchant_account.rs index 24cb4b42db..47851ae263 100644 --- a/crates/router/src/db/merchant_account.rs +++ b/crates/router/src/db/merchant_account.rs @@ -527,8 +527,7 @@ impl MerchantAccountInterface for MockDb { .find(|account| account.get_id() == merchant_id) .cloned() .ok_or(errors::StorageError::ValueNotFound(format!( - "Merchant ID: {:?} not found", - merchant_id + "Merchant ID: {merchant_id:?} not found", )))? .convert( state, @@ -572,8 +571,7 @@ impl MerchantAccountInterface for MockDb { .transpose()? .ok_or( errors::StorageError::ValueNotFound(format!( - "Merchant ID: {:?} not found", - merchant_id + "Merchant ID: {merchant_id:?} not found", )) .into(), ) @@ -607,8 +605,7 @@ impl MerchantAccountInterface for MockDb { .transpose()? .ok_or( errors::StorageError::ValueNotFound(format!( - "Merchant ID: {:?} not found", - merchant_id + "Merchant ID: {merchant_id:?} not found", )) .into(), ) @@ -630,8 +627,7 @@ impl MerchantAccountInterface for MockDb { .is_some_and(|key| key == publishable_key) }) .ok_or(errors::StorageError::ValueNotFound(format!( - "Publishable Key: {} not found", - publishable_key + "Publishable Key: {publishable_key} not found", )))?; let key_store = self .get_merchant_key_store_by_merchant_id( diff --git a/crates/router/src/db/merchant_key_store.rs b/crates/router/src/db/merchant_key_store.rs index 0a6fe4c3bb..c1ce0f5fea 100644 --- a/crates/router/src/db/merchant_key_store.rs +++ b/crates/router/src/db/merchant_key_store.rs @@ -268,8 +268,7 @@ impl MerchantKeyStoreInterface for MockDb { .iter() .position(|mks| mks.merchant_id == *merchant_id) .ok_or(errors::StorageError::ValueNotFound(format!( - "No merchant key store found for merchant_id = {:?}", - merchant_id + "No merchant key store found for merchant_id = {merchant_id:?}", )))?; merchant_key_stores.remove(index); Ok(true) diff --git a/crates/router/src/db/organization.rs b/crates/router/src/db/organization.rs index bb4f125db2..f809e6bb88 100644 --- a/crates/router/src/db/organization.rs +++ b/crates/router/src/db/organization.rs @@ -97,8 +97,7 @@ impl OrganizationInterface for super::MockDb { .cloned() .ok_or( errors::StorageError::ValueNotFound(format!( - "No organization available for org_id = {:?}", - org_id + "No organization available for org_id = {org_id:?}", )) .into(), ) @@ -132,8 +131,7 @@ impl OrganizationInterface for super::MockDb { }) .ok_or( errors::StorageError::ValueNotFound(format!( - "No organization available for org_id = {:?}", - org_id + "No organization available for org_id = {org_id:?}", )) .into(), ) diff --git a/crates/router/src/db/reverse_lookup.rs b/crates/router/src/db/reverse_lookup.rs index c022c70d9e..7704b4f71c 100644 --- a/crates/router/src/db/reverse_lookup.rs +++ b/crates/router/src/db/reverse_lookup.rs @@ -217,8 +217,7 @@ impl ReverseLookupInterface for MockDb { .find(|reverse_lookup| reverse_lookup.lookup_id == lookup_id) .ok_or( errors::StorageError::ValueNotFound(format!( - "No reverse lookup found for lookup_id = {}", - lookup_id + "No reverse lookup found for lookup_id = {lookup_id}", )) .into(), ) diff --git a/crates/router/src/db/user/theme.rs b/crates/router/src/db/user/theme.rs index 0a52144e5c..becd89adfd 100644 --- a/crates/router/src/db/user/theme.rs +++ b/crates/router/src/db/user/theme.rs @@ -226,11 +226,8 @@ impl ThemeInterface for MockDb { .find(|theme| theme.theme_id == theme_id) .cloned() .ok_or( - errors::StorageError::ValueNotFound(format!( - "Theme with id {} not found", - theme_id - )) - .into(), + errors::StorageError::ValueNotFound(format!("Theme with id {theme_id} not found")) + .into(), ) } @@ -266,8 +263,7 @@ impl ThemeInterface for MockDb { .cloned() .ok_or( errors::StorageError::ValueNotFound(format!( - "Theme with lineage {:?} not found", - lineage + "Theme with lineage {lineage:?} not found", )) .into(), ) @@ -296,8 +292,7 @@ impl ThemeInterface for MockDb { }) .ok_or_else(|| { report!(errors::StorageError::ValueNotFound(format!( - "Theme with id {} not found", - theme_id, + "Theme with id {theme_id} not found", ))) }) } @@ -314,8 +309,7 @@ impl ThemeInterface for MockDb { theme.theme_id == theme_id && check_theme_with_lineage(theme, &lineage) }) .ok_or(errors::StorageError::ValueNotFound(format!( - "Theme with id {} and lineage {:?} not found", - theme_id, lineage + "Theme with id {theme_id} and lineage {lineage:?} not found", )))?; let theme = themes.remove(index); diff --git a/crates/router/src/db/user_authentication_method.rs b/crates/router/src/db/user_authentication_method.rs index cd918fe206..5a6d28dd3c 100644 --- a/crates/router/src/db/user_authentication_method.rs +++ b/crates/router/src/db/user_authentication_method.rs @@ -171,8 +171,7 @@ impl UserAuthenticationMethodInterface for MockDb { Ok(user_authentication_method.to_owned()) } else { return Err(errors::StorageError::ValueNotFound(format!( - "No user authentication method found for id = {}", - id + "No user authentication method found for id = {id}", )) .into()); } @@ -191,8 +190,7 @@ impl UserAuthenticationMethodInterface for MockDb { .collect(); if user_authentication_methods_list.is_empty() { return Err(errors::StorageError::ValueNotFound(format!( - "No user authentication method found for auth_id = {}", - auth_id + "No user authentication method found for auth_id = {auth_id}", )) .into()); } @@ -213,8 +211,7 @@ impl UserAuthenticationMethodInterface for MockDb { .collect(); if user_authentication_methods_list.is_empty() { return Err(errors::StorageError::ValueNotFound(format!( - "No user authentication method found for owner_id = {}", - owner_id + "No user authentication method found for owner_id = {owner_id}", )) .into()); } diff --git a/crates/router/src/db/user_key_store.rs b/crates/router/src/db/user_key_store.rs index eef0d0c837..952b2f3ac2 100644 --- a/crates/router/src/db/user_key_store.rs +++ b/crates/router/src/db/user_key_store.rs @@ -173,8 +173,7 @@ impl UserKeyStoreInterface for MockDb { .find(|user_key_store| user_key_store.user_id == user_id) .cloned() .ok_or(errors::StorageError::ValueNotFound(format!( - "No user_key_store is found for user_id={}", - user_id + "No user_key_store is found for user_id={user_id}", )))? .convert(state, key, keymanager::Identifier::User(user_id.to_owned())) .await diff --git a/crates/router/src/db/user_role.rs b/crates/router/src/db/user_role.rs index 1df6160f81..75bf66da70 100644 --- a/crates/router/src/db/user_role.rs +++ b/crates/router/src/db/user_role.rs @@ -320,8 +320,7 @@ impl UserRoleInterface for MockDb { } Err(errors::StorageError::ValueNotFound(format!( - "No user role available for user_id = {} in the current token hierarchy", - user_id + "No user role available for user_id = {user_id} in the current token hierarchy", )) .into()) } diff --git a/crates/router/src/middleware.rs b/crates/router/src/middleware.rs index 64a2138519..c87a774c1c 100644 --- a/crates/router/src/middleware.rs +++ b/crates/router/src/middleware.rs @@ -178,14 +178,14 @@ where fn get_request_details_from_value(json_value: &serde_json::Value, parent_key: &str) -> String { match json_value { - serde_json::Value::Null => format!("{}: null", parent_key), - serde_json::Value::Bool(b) => format!("{}: {}", parent_key, b), + serde_json::Value::Null => format!("{parent_key}: null"), + serde_json::Value::Bool(b) => format!("{parent_key}: {b}"), serde_json::Value::Number(num) => format!("{}: {}", parent_key, num.to_string().len()), serde_json::Value::String(s) => format!("{}: {}", parent_key, s.len()), serde_json::Value::Array(arr) => { let mut result = String::new(); for (index, value) in arr.iter().enumerate() { - let child_key = format!("{}[{}]", parent_key, index); + let child_key = format!("{parent_key}[{index}]"); result.push_str(&get_request_details_from_value(value, &child_key)); if index < arr.len() - 1 { result.push_str(", "); @@ -196,7 +196,7 @@ fn get_request_details_from_value(json_value: &serde_json::Value, parent_key: &s serde_json::Value::Object(obj) => { let mut result = String::new(); for (index, (key, value)) in obj.iter().enumerate() { - let child_key = format!("{}[{}]", parent_key, key); + let child_key = format!("{parent_key}[{key}]"); result.push_str(&get_request_details_from_value(value, &child_key)); if index < obj.len() - 1 { result.push_str(", "); @@ -376,8 +376,7 @@ where let locale_param = serde_qs::from_str::(query_params).map_err(|error| { actix_web::error::ErrorBadRequest(format!( - "Could not convert query params to locale query parmas: {:?}", - error + "Could not convert query params to locale query parmas: {error:?}", )) })?; let accept_language_header = req.headers().get(http::header::ACCEPT_LANGUAGE); diff --git a/crates/router/src/routes/dummy_connector/types.rs b/crates/router/src/routes/dummy_connector/types.rs index e58342c258..237a0fa2ea 100644 --- a/crates/router/src/routes/dummy_connector/types.rs +++ b/crates/router/src/routes/dummy_connector/types.rs @@ -51,7 +51,7 @@ impl DummyConnectors { Self::PaypalTest => "PAYPAL_TEST.svg", _ => "PHONYPAY.svg", }; - format!("{}{}", base_url, image_name) + format!("{base_url}{image_name}") } } @@ -229,7 +229,7 @@ impl GetPaymentMethodDetails for DummyConnectorUpiType { let image_name = match self { Self::UpiCollect => "UPI_COLLECT.svg", }; - format!("{}{}", base_url, image_name) + format!("{base_url}{image_name}") } } @@ -253,7 +253,7 @@ impl GetPaymentMethodDetails for DummyConnectorWallet { Self::AliPay => "ALIPAY.svg", Self::AliPayHK => "ALIPAY.svg", }; - format!("{}{}", base_url, image_name) + format!("{base_url}{image_name}") } } @@ -278,7 +278,7 @@ impl GetPaymentMethodDetails for DummyConnectorPayLater { Self::Affirm => "AFFIRM.svg", Self::AfterPayClearPay => "AFTERPAY.svg", }; - format!("{}{}", base_url, image_name) + format!("{base_url}{image_name}") } } diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs index 31558c2d32..8dac786ff3 100644 --- a/crates/router/src/routes/payment_methods.rs +++ b/crates/router/src/routes/payment_methods.rs @@ -991,10 +991,7 @@ impl ParentPaymentMethodToken { (parent_pm_token, payment_method): (&String, api_models::enums::PaymentMethod), ) -> Self { Self { - key_for_token: format!( - "pm_token_{}_{}_hyperswitch", - parent_pm_token, payment_method - ), + key_for_token: format!("pm_token_{parent_pm_token}_{payment_method}_hyperswitch"), } } @@ -1002,10 +999,7 @@ impl ParentPaymentMethodToken { pub fn return_key_for_token( (parent_pm_token, payment_method): (&String, api_models::enums::PaymentMethod), ) -> String { - format!( - "pm_token_{}_{}_hyperswitch", - parent_pm_token, payment_method - ) + format!("pm_token_{parent_pm_token}_{payment_method}_hyperswitch") } pub async fn insert( diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs index a80f2dc1d0..57bb8ec242 100644 --- a/crates/router/src/services/api.rs +++ b/crates/router/src/services/api.rs @@ -845,16 +845,14 @@ where .into_iter() .collect::>() .join(" "); - let csp_header = format!("frame-ancestors 'self' {};", domains_str); + let csp_header = format!("frame-ancestors 'self' {domains_str};"); Some(HashSet::from([("content-security-policy", csp_header)])) } else { None }; http_response_html_data(rendered_html, headers) } - Err(_) => { - http_response_err(format!("Error while rendering {} HTML page", link_type)) - } + Err(_) => http_response_err(format!("Error while rendering {link_type} HTML page")), } } @@ -1222,10 +1220,9 @@ pub fn build_redirection_form( } } }, - RedirectForm::Html { html_data } => PreEscaped(format!( - "{} ", - html_data, logging_template - )), + RedirectForm::Html { html_data } => { + PreEscaped(format!("{html_data} ")) + } RedirectForm::BlueSnap { payment_fields_token, } => { @@ -1989,7 +1986,6 @@ fn get_preload_link_html_template(sdk_url: &url::Url) -> String { format!( r#" "#, - sdk_url = sdk_url ) } diff --git a/crates/router/src/services/api/generic_link_response.rs b/crates/router/src/services/api/generic_link_response.rs index c47539eb8d..7c418c2561 100644 --- a/crates/router/src/services/api/generic_link_response.rs +++ b/crates/router/src/services/api/generic_link_response.rs @@ -64,13 +64,13 @@ fn build_html_template( // Insert dynamic context in CSS let css_dynamic_context = "{{ color_scheme }}"; let css_template = styles.to_string(); - let final_css = format!("{}\n{}", css_dynamic_context, css_template); + let final_css = format!("{css_dynamic_context}\n{css_template}"); let _ = tera.add_raw_template("document_styles", &final_css); context.insert("color_scheme", &link_data.css_data); let css_style_tag = tera .render("document_styles", &context) - .map(|css| format!("", css)) + .map(|css| format!("")) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to render CSS template")?; @@ -95,13 +95,13 @@ pub fn build_payout_link_html( let script = include_str!("../../core/generic_link/payout_link/initiate/script.js"); let js_template = script.to_string(); let js_dynamic_context = "{{ script_data }}"; - let final_js = format!("{}\n{}", js_dynamic_context, js_template); + let final_js = format!("{js_dynamic_context}\n{js_template}"); let _ = tera.add_raw_template("document_scripts", &final_js); context.insert("script_data", &link_data.js_data); context::insert_locales_in_context_for_payout_link(&mut context, locale); let js_script_tag = tera .render("document_scripts", &context) - .map(|js| format!("", js)) + .map(|js| format!("")) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to render JS template")?; context.insert("js_script_tag", &js_script_tag); @@ -134,12 +134,12 @@ pub fn build_pm_collect_link_html( let script = include_str!("../../core/generic_link/payment_method_collect/initiate/script.js"); let js_template = script.to_string(); let js_dynamic_context = "{{ script_data }}"; - let final_js = format!("{}\n{}", js_dynamic_context, js_template); + let final_js = format!("{js_dynamic_context}\n{js_template}"); let _ = tera.add_raw_template("document_scripts", &final_js); context.insert("script_data", &link_data.js_data); let js_script_tag = tera .render("document_scripts", &context) - .map(|js| format!("", js)) + .map(|js| format!("")) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to render JS template")?; context.insert("js_script_tag", &js_script_tag); @@ -168,13 +168,13 @@ pub fn build_payout_link_status_html( let css_dynamic_context = "{{ color_scheme }}"; let css_template = include_str!("../../core/generic_link/payout_link/status/styles.css").to_string(); - let final_css = format!("{}\n{}", css_dynamic_context, css_template); + let final_css = format!("{css_dynamic_context}\n{css_template}"); let _ = tera.add_raw_template("payout_link_status_styles", &final_css); context.insert("color_scheme", &link_data.css_data); let css_style_tag = tera .render("payout_link_status_styles", &context) - .map(|css| format!("", css)) + .map(|css| format!("")) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to render payout link status CSS template")?; @@ -182,13 +182,13 @@ pub fn build_payout_link_status_html( let js_dynamic_context = "{{ script_data }}"; let js_template = include_str!("../../core/generic_link/payout_link/status/script.js").to_string(); - let final_js = format!("{}\n{}", js_dynamic_context, js_template); + let final_js = format!("{js_dynamic_context}\n{js_template}"); let _ = tera.add_raw_template("payout_link_status_script", &final_js); context.insert("script_data", &link_data.js_data); context::insert_locales_in_context_for_payout_link_status(&mut context, locale); let js_script_tag = tera .render("payout_link_status_script", &context) - .map(|js| format!("", js)) + .map(|js| format!("")) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to render payout link status JS template")?; @@ -215,13 +215,13 @@ pub fn build_pm_collect_link_status_html( let css_template = include_str!("../../core/generic_link/payment_method_collect/status/styles.css") .to_string(); - let final_css = format!("{}\n{}", css_dynamic_context, css_template); + let final_css = format!("{css_dynamic_context}\n{css_template}"); let _ = tera.add_raw_template("pm_collect_link_status_styles", &final_css); context.insert("color_scheme", &link_data.css_data); let css_style_tag = tera .render("pm_collect_link_status_styles", &context) - .map(|css| format!("", css)) + .map(|css| format!("")) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to render payment method collect link status CSS template")?; @@ -229,13 +229,13 @@ pub fn build_pm_collect_link_status_html( let js_dynamic_context = "{{ collect_link_status_context }}"; let js_template = include_str!("../../core/generic_link/payment_method_collect/status/script.js").to_string(); - let final_js = format!("{}\n{}", js_dynamic_context, js_template); + let final_js = format!("{js_dynamic_context}\n{js_template}"); let _ = tera.add_raw_template("pm_collect_link_status_script", &final_js); context.insert("collect_link_status_context", &link_data.js_data); let js_script_tag = tera .render("pm_collect_link_status_script", &context) - .map(|js| format!("", js)) + .map(|js| format!("")) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to render payment method collect link status JS template")?; diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs index d16063939a..564c9f9d3e 100644 --- a/crates/router/src/services/authentication.rs +++ b/crates/router/src/services/authentication.rs @@ -1912,16 +1912,15 @@ impl<'a> HeaderMapStruct<'a> { self.headers .get(key) .ok_or(errors::ApiErrorResponse::InvalidRequestData { - message: format!("Missing header key: `{}`", key), + message: format!("Missing header key: `{key}`"), }) - .attach_printable(format!("Failed to find header key: {}", key))? + .attach_printable(format!("Failed to find header key: {key}"))? .to_str() .change_context(errors::ApiErrorResponse::InvalidDataValue { field_name: "`{key}` in headers", }) .attach_printable(format!( - "Failed to convert header value to string for header key: {}", - key + "Failed to convert header value to string for header key: {key}", )) } @@ -1941,7 +1940,7 @@ impl<'a> HeaderMapStruct<'a> { .and_then(|header_value| { T::try_from(std::borrow::Cow::Owned(header_value)).change_context( errors::ApiErrorResponse::InvalidRequestData { - message: format!("`{}` header is invalid", key), + message: format!("`{key}` header is invalid"), }, ) }) @@ -1985,13 +1984,12 @@ impl<'a> HeaderMapStruct<'a> { field_name: "`{key}` in headers", }) .attach_printable(format!( - "Failed to convert header value to string for header key: {}", - key + "Failed to convert header value to string for header key: {key}", ))? .map(|value| { T::try_from(std::borrow::Cow::Owned(value.to_owned())).change_context( errors::ApiErrorResponse::InvalidRequestData { - message: format!("`{}` header is invalid", key), + message: format!("`{key}` header is invalid"), }, ) }) @@ -4356,8 +4354,7 @@ pub fn get_header_value_by_key(key: String, headers: &HeaderMap) -> RouterResult .to_str() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable(format!( - "Failed to convert header value to string for header key: {}", - key + "Failed to convert header value to string for header key: {key}", )) }) .transpose() diff --git a/crates/router/src/services/authentication/blacklist.rs b/crates/router/src/services/authentication/blacklist.rs index 77dd9861a0..055cdc1b54 100644 --- a/crates/router/src/services/authentication/blacklist.rs +++ b/crates/router/src/services/authentication/blacklist.rs @@ -24,7 +24,7 @@ use crate::{ #[cfg(feature = "olap")] pub async fn insert_user_in_blacklist(state: &SessionState, user_id: &str) -> UserResult<()> { - let user_blacklist_key = format!("{}{}", USER_BLACKLIST_PREFIX, user_id); + let user_blacklist_key = format!("{USER_BLACKLIST_PREFIX}{user_id}"); let expiry = expiry_to_i64(JWT_TOKEN_TIME_IN_SECS).change_context(UserErrors::InternalServerError)?; let redis_conn = get_redis_connection_for_global_tenant(state) @@ -41,7 +41,7 @@ pub async fn insert_user_in_blacklist(state: &SessionState, user_id: &str) -> Us #[cfg(feature = "olap")] pub async fn insert_role_in_blacklist(state: &SessionState, role_id: &str) -> UserResult<()> { - let role_blacklist_key = format!("{}{}", ROLE_BLACKLIST_PREFIX, role_id); + let role_blacklist_key = format!("{ROLE_BLACKLIST_PREFIX}{role_id}"); let expiry = expiry_to_i64(JWT_TOKEN_TIME_IN_SECS).change_context(UserErrors::InternalServerError)?; let redis_conn = get_redis_connection_for_global_tenant(state) @@ -74,7 +74,7 @@ pub async fn check_user_in_blacklist( user_id: &str, token_expiry: u64, ) -> RouterResult { - let token = format!("{}{}", USER_BLACKLIST_PREFIX, user_id); + let token = format!("{USER_BLACKLIST_PREFIX}{user_id}"); let token_issued_at = expiry_to_i64(token_expiry - JWT_TOKEN_TIME_IN_SECS)?; let redis_conn = get_redis_connection_for_global_tenant(state)?; redis_conn @@ -89,7 +89,7 @@ pub async fn check_role_in_blacklist( role_id: &str, token_expiry: u64, ) -> RouterResult { - let token = format!("{}{}", ROLE_BLACKLIST_PREFIX, role_id); + let token = format!("{ROLE_BLACKLIST_PREFIX}{role_id}"); let token_issued_at = expiry_to_i64(token_expiry - JWT_TOKEN_TIME_IN_SECS)?; let redis_conn = get_redis_connection_for_global_tenant(state)?; redis_conn @@ -103,7 +103,7 @@ pub async fn check_role_in_blacklist( pub async fn insert_email_token_in_blacklist(state: &SessionState, token: &str) -> UserResult<()> { let redis_conn = get_redis_connection_for_global_tenant(state) .change_context(UserErrors::InternalServerError)?; - let blacklist_key = format!("{}{token}", EMAIL_TOKEN_BLACKLIST_PREFIX); + let blacklist_key = format!("{EMAIL_TOKEN_BLACKLIST_PREFIX}{token}"); let expiry = expiry_to_i64(EMAIL_TOKEN_TIME_IN_SECS).change_context(UserErrors::InternalServerError)?; redis_conn @@ -116,7 +116,7 @@ pub async fn insert_email_token_in_blacklist(state: &SessionState, token: &str) pub async fn check_email_token_in_blacklist(state: &SessionState, token: &str) -> UserResult<()> { let redis_conn = get_redis_connection_for_global_tenant(state) .change_context(UserErrors::InternalServerError)?; - let blacklist_key = format!("{}{token}", EMAIL_TOKEN_BLACKLIST_PREFIX); + let blacklist_key = format!("{EMAIL_TOKEN_BLACKLIST_PREFIX}{token}"); let key_exists = redis_conn .exists::<()>(&blacklist_key.as_str().into()) .await diff --git a/crates/router/src/services/authentication/detached.rs b/crates/router/src/services/authentication/detached.rs index 9d77d2b1f0..544618270f 100644 --- a/crates/router/src/services/authentication/detached.rs +++ b/crates/router/src/services/authentication/detached.rs @@ -39,15 +39,15 @@ impl ExtractedPayload { .get(HEADER_MERCHANT_ID) .and_then(|value| value.to_str().ok()) .ok_or_else(|| ApiErrorResponse::InvalidRequestData { - message: format!("`{}` header is invalid or not present", HEADER_MERCHANT_ID), + message: format!("`{HEADER_MERCHANT_ID}` header is invalid or not present"), }) .map_err(error_stack::Report::from) .and_then(|merchant_id| { MerchantId::try_from(Cow::from(merchant_id.to_string())).change_context( ApiErrorResponse::InvalidRequestData { message: format!( - "`{}` header is invalid or not present", - HEADER_MERCHANT_ID + "`{HEADER_MERCHANT_ID}` header is invalid or not present", + ), }, ) @@ -57,11 +57,11 @@ impl ExtractedPayload { .get(HEADER_AUTH_TYPE) .and_then(|inner| inner.to_str().ok()) .ok_or_else(|| ApiErrorResponse::InvalidRequestData { - message: format!("`{}` header not present", HEADER_AUTH_TYPE), + message: format!("`{HEADER_AUTH_TYPE}` header not present"), })? .parse::() .change_context(ApiErrorResponse::InvalidRequestData { - message: format!("`{}` header not present", HEADER_AUTH_TYPE), + message: format!("`{HEADER_AUTH_TYPE}` header not present"), })?; let key_id = headers @@ -70,7 +70,7 @@ impl ExtractedPayload { .map(|key_id| ApiKeyId::try_from(Cow::from(key_id.to_string()))) .transpose() .change_context(ApiErrorResponse::InvalidRequestData { - message: format!("`{}` header is invalid or not present", HEADER_KEY_ID), + message: format!("`{HEADER_KEY_ID}` header is invalid or not present"), })?; Ok(Self { @@ -112,7 +112,7 @@ impl ExtractedPayload { #[inline] fn append_option(prefix: &str, data: &Option) -> String { match data { - Some(inner) => format!("{}:{}", prefix, inner), + Some(inner) => format!("{prefix}:{inner}"), None => prefix.to_string(), } } diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs index e189a0f1a4..d4f4b6d220 100644 --- a/crates/router/src/types/api.rs +++ b/crates/router/src/types/api.rs @@ -217,7 +217,7 @@ impl ForeignTryFrom for RoutableConnectorChoice { merchant_connector_id: from.merchant_connector_id, }), Err(e) => Err(common_utils::errors::ValidationError::InvalidValue { - message: format!("This is not a routable connector: {:?}", e), + message: format!("This is not a routable connector: {e:?}"), })?, } } @@ -311,10 +311,7 @@ impl ConnectorData { .change_context(errors::ConnectorError::InvalidConnectorName) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable_lazy(|| { - format!( - "unable to parse external vault connector name {:?}", - connector - ) + format!("unable to parse external vault connector name {connector:?}") })?; let connector_name = api_enums::Connector::from(external_vault_connector_name); Ok(Self { diff --git a/crates/router/src/types/api/connector_onboarding/paypal.rs b/crates/router/src/types/api/connector_onboarding/paypal.rs index a1f3155cd4..ee089db3b4 100644 --- a/crates/router/src/types/api/connector_onboarding/paypal.rs +++ b/crates/router/src/types/api/connector_onboarding/paypal.rs @@ -179,7 +179,7 @@ impl SellerStatusResponse { self.links .first() .and_then(|link| link.href.strip_prefix('/')) - .map(|link| format!("{}{}", paypal_base_url, link)) + .map(|link| format!("{paypal_base_url}{link}")) .ok_or(ApiErrorResponse::InternalServerError) .attach_printable("Merchant details not received in onboarding status") } diff --git a/crates/router/src/types/domain/user.rs b/crates/router/src/types/domain/user.rs index 0ff4c388f7..88e5c95e05 100644 --- a/crates/router/src/types/domain/user.rs +++ b/crates/router/src/types/domain/user.rs @@ -1343,7 +1343,7 @@ impl RecoveryCodes { let code_part_2 = Alphanumeric.sample_string(&mut rand, consts::user::RECOVERY_CODE_LENGTH / 2); - Secret::new(format!("{}-{}", code_part_1, code_part_2)) + Secret::new(format!("{code_part_1}-{code_part_2}")) }) .collect::>(); diff --git a/crates/router/src/utils/connector_onboarding.rs b/crates/router/src/utils/connector_onboarding.rs index 8ea71fb9d6..71847ba1e0 100644 --- a/crates/router/src/utils/connector_onboarding.rs +++ b/crates/router/src/utils/connector_onboarding.rs @@ -22,8 +22,7 @@ pub fn get_connector_auth( }), _ => Err(ApiErrorResponse::NotImplemented { message: NotImplementedMessage::Reason(format!( - "Onboarding is not implemented for {}", - connector + "Onboarding is not implemented for {connector}", )), } .into()), diff --git a/crates/router/src/utils/connector_onboarding/paypal.rs b/crates/router/src/utils/connector_onboarding/paypal.rs index 33b85587b4..fdb34375db 100644 --- a/crates/router/src/utils/connector_onboarding/paypal.rs +++ b/crates/router/src/utils/connector_onboarding/paypal.rs @@ -53,7 +53,7 @@ where .attach_default_headers() .header( header::AUTHORIZATION.to_string().as_str(), - format!("Bearer {}", access_token).as_str(), + format!("Bearer {access_token}").as_str(), ) .header( header::CONTENT_TYPE.to_string().as_str(), @@ -70,7 +70,7 @@ pub fn build_paypal_get_request(url: String, access_token: String) -> RouterResu .attach_default_headers() .header( header::AUTHORIZATION.to_string().as_str(), - format!("Bearer {}", access_token).as_str(), + format!("Bearer {access_token}").as_str(), ) .build()) } diff --git a/crates/router/src/utils/currency.rs b/crates/router/src/utils/currency.rs index 6e35353af6..44b42cd3bc 100644 --- a/crates/router/src/utils/currency.rs +++ b/crates/router/src/utils/currency.rs @@ -291,7 +291,7 @@ async fn fetch_forex_rates_from_primary_api( let forex_api_key = state.conf.forex_api.get_inner().api_key.peek(); logger::debug!("forex_log: Primary api call for forex fetch"); - let forex_url: String = format!("{}{}{}", FOREX_BASE_URL, forex_api_key, FOREX_BASE_CURRENCY); + let forex_url: String = format!("{FOREX_BASE_URL}{forex_api_key}{FOREX_BASE_CURRENCY}"); let forex_request = services::RequestBuilder::new() .method(services::Method::Get) .url(&forex_url) @@ -356,8 +356,7 @@ pub async fn fetch_forex_rates_from_fallback_api( ) -> CustomResult { let fallback_forex_api_key = state.conf.forex_api.get_inner().fallback_api_key.peek(); - let fallback_forex_url: String = - format!("{}{}", FALLBACK_FOREX_BASE_URL, fallback_forex_api_key,); + let fallback_forex_url: String = format!("{FALLBACK_FOREX_BASE_URL}{fallback_forex_api_key}"); let fallback_forex_request = services::RequestBuilder::new() .method(services::Method::Get) .url(&fallback_forex_url) diff --git a/crates/router/src/utils/user.rs b/crates/router/src/utils/user.rs index baeeb89d17..41a1b90bb7 100644 --- a/crates/router/src/utils/user.rs +++ b/crates/router/src/utils/user.rs @@ -214,7 +214,7 @@ where { serde_json::from_value::(value) .change_context(UserErrors::InternalServerError) - .attach_printable(format!("Unable to parse {}", type_name)) + .attach_printable(format!("Unable to parse {type_name}")) } pub async fn decrypt_oidc_private_config( @@ -285,7 +285,7 @@ pub async fn get_sso_id_from_redis( } fn get_oidc_key(oidc_state: &str) -> String { - format!("{}{oidc_state}", REDIS_SSO_PREFIX) + format!("{REDIS_SSO_PREFIX}{oidc_state}") } pub fn get_oidc_sso_redirect_url(state: &SessionState, provider: &str) -> String { diff --git a/crates/router/src/utils/user/theme.rs b/crates/router/src/utils/user/theme.rs index 33e1450f09..8da447ac76 100644 --- a/crates/router/src/utils/user/theme.rs +++ b/crates/router/src/utils/user/theme.rs @@ -29,7 +29,7 @@ pub fn get_theme_file_key(theme_id: &str) -> PathBuf { fn path_buf_to_str(path: &PathBuf) -> UserResult<&str> { path.to_str() .ok_or(UserErrors::InternalServerError) - .attach_printable(format!("Failed to convert path {:#?} to string", path)) + .attach_printable(format!("Failed to convert path {path:#?} to string")) } pub async fn retrieve_file_from_theme_bucket( diff --git a/crates/router/src/utils/user_role.rs b/crates/router/src/utils/user_role.rs index 64cdf2ad4c..c1d9dc10b0 100644 --- a/crates/router/src/utils/user_role.rs +++ b/crates/router/src/utils/user_role.rs @@ -502,8 +502,7 @@ pub fn get_min_entity( if user_entity < filter_entity { return Err(report!(UserErrors::InvalidRoleOperation)).attach_printable(format!( - "{} level user requesting data for {:?} level", - user_entity, filter_entity + "{user_entity} level user requesting data for {filter_entity:?} level", )); } diff --git a/crates/router/tests/connectors/adyen.rs b/crates/router/tests/connectors/adyen.rs index d7017d3d44..3737be3a1b 100644 --- a/crates/router/tests/connectors/adyen.rs +++ b/crates/router/tests/connectors/adyen.rs @@ -465,7 +465,7 @@ async fn should_fail_payment_for_incorrect_card_number() { ) .await .unwrap(); - assert_eq!(response.response.unwrap_err().message, "Refused",); + assert_eq!(response.response.unwrap_err().message, "Refused"); } // Creates a payment with incorrect CVC. @@ -529,7 +529,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { ) .await .unwrap(); - assert_eq!(response.response.unwrap_err().message, "Expired Card",); + assert_eq!(response.response.unwrap_err().message, "Expired Card"); } // Captures a payment using invalid connector payment id. diff --git a/crates/router/tests/connectors/cybersource.rs b/crates/router/tests/connectors/cybersource.rs index 08001ddd78..4a1c5af567 100644 --- a/crates/router/tests/connectors/cybersource.rs +++ b/crates/router/tests/connectors/cybersource.rs @@ -195,7 +195,7 @@ async fn should_fail_payment_for_invalid_exp_year() { .await .unwrap(); let x = response.response.unwrap_err(); - assert_eq!(x.message, "Decline - Expired card. You might also receive this if the expiration date you provided does not match the date the issuing bank has on file.",); + assert_eq!(x.message, "Decline - Expired card. You might also receive this if the expiration date you provided does not match the date the issuing bank has on file."); } #[actix_web::test] async fn should_fail_payment_for_invalid_card_cvc() { diff --git a/crates/router/tests/connectors/dlocal.rs b/crates/router/tests/connectors/dlocal.rs index 3022f1f0b1..0e9df8a454 100644 --- a/crates/router/tests/connectors/dlocal.rs +++ b/crates/router/tests/connectors/dlocal.rs @@ -302,7 +302,7 @@ async fn should_fail_payment_for_incorrect_card_number() { .await .unwrap(); let x = response.response.unwrap_err(); - assert_eq!(x.message, "Invalid parameter",); + assert_eq!(x.message, "Invalid parameter"); assert_eq!(x.reason, Some("card.number".to_string())); } @@ -323,7 +323,7 @@ async fn should_fail_payment_for_incorrect_cvc() { .await .unwrap(); let x = response.response.unwrap_err(); - assert_eq!(x.message, "Invalid parameter",); + assert_eq!(x.message, "Invalid parameter"); assert_eq!(x.reason, Some("card.cvv".to_string())); } @@ -344,7 +344,7 @@ async fn should_fail_payment_for_invalid_exp_month() { .await .unwrap(); let x = response.response.unwrap_err(); - assert_eq!(x.message, "Invalid parameter",); + assert_eq!(x.message, "Invalid parameter"); assert_eq!(x.reason, Some("card.expiration_month".to_string())); } @@ -365,7 +365,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() { .await .unwrap(); let x = response.response.unwrap_err(); - assert_eq!(x.message, "Invalid parameter",); + assert_eq!(x.message, "Invalid parameter"); assert_eq!(x.reason, Some("card.expiration_year".to_string())); } @@ -384,7 +384,7 @@ async fn should_fail_void_payment_for_auto_capture() { .await .unwrap(); let x = void_response.response.unwrap_err(); - assert_eq!(x.code, "5021",); + assert_eq!(x.code, "5021"); assert_eq!(x.message, "Acquirer could not process the request"); } @@ -396,7 +396,7 @@ async fn should_fail_capture_for_invalid_payment() { .await .unwrap(); let x = capture_response.response.unwrap_err(); - assert_eq!(x.code, "3003",); + assert_eq!(x.code, "3003"); } // Refunds a payment with refund amount higher than payment amount. @@ -416,8 +416,8 @@ async fn should_fail_for_refund_amount_higher_than_payment_amount() { let x = response.response.unwrap_err(); println!("response from refund amount higher payment"); println!("{}", x.code); - assert_eq!(x.code, "5007",); - assert_eq!(x.message, "Amount exceeded",); + assert_eq!(x.code, "5007"); + assert_eq!(x.message, "Amount exceeded"); } pub fn get_payment_info() -> PaymentInfo { diff --git a/crates/router/tests/connectors/powertranz.rs b/crates/router/tests/connectors/powertranz.rs index 536b3241be..d94ed80e80 100644 --- a/crates/router/tests/connectors/powertranz.rs +++ b/crates/router/tests/connectors/powertranz.rs @@ -411,7 +411,7 @@ async fn should_fail_for_refund_amount_higher_than_payment_amount() { ) .await .unwrap(); - assert_eq!(response.response.unwrap_err().message, "Invalid amount",); + assert_eq!(response.response.unwrap_err().message, "Invalid amount"); } // Connector dependent test cases goes here diff --git a/crates/router/tests/connectors/stripe.rs b/crates/router/tests/connectors/stripe.rs index 54b3208550..5b99e0f859 100644 --- a/crates/router/tests/connectors/stripe.rs +++ b/crates/router/tests/connectors/stripe.rs @@ -213,7 +213,7 @@ async fn should_fail_payment_for_invalid_exp_year() { .await .unwrap(); let x = response.response.unwrap_err(); - assert_eq!(x.reason.unwrap(), "Your card's expiration year is invalid.",); + assert_eq!(x.reason.unwrap(), "Your card's expiration year is invalid."); } #[actix_web::test] @@ -232,7 +232,7 @@ async fn should_fail_payment_for_invalid_card_cvc() { .await .unwrap(); let x = response.response.unwrap_err(); - assert_eq!(x.reason.unwrap(), "Your card's security code is invalid.",); + assert_eq!(x.reason.unwrap(), "Your card's security code is invalid."); } // Voids a payment using automatic capture flow (Non 3DS). diff --git a/crates/storage_impl/src/kv_router_store.rs b/crates/storage_impl/src/kv_router_store.rs index 5118d902d9..7827f3a2a5 100644 --- a/crates/storage_impl/src/kv_router_store.rs +++ b/crates/storage_impl/src/kv_router_store.rs @@ -179,7 +179,7 @@ impl KVRouterStore { where R: KvStorePartition, { - let global_id = format!("{}", partition_key); + let global_id = format!("{partition_key}"); let request_id = self.request_id.clone().unwrap_or_default(); let shard_key = R::shard_key(partition_key, self.drainer_num_partitions); diff --git a/crates/storage_impl/src/payment_method.rs b/crates/storage_impl/src/payment_method.rs index 74be922c7f..760f09e8eb 100644 --- a/crates/storage_impl/src/payment_method.rs +++ b/crates/storage_impl/src/payment_method.rs @@ -50,7 +50,7 @@ impl PaymentMethodInterface for KVRouterStore { key_store, storage_scheme, PaymentMethod::find_by_payment_method_id(&conn, payment_method_id), - FindResourceBy::LookupId(format!("payment_method_{}", payment_method_id)), + FindResourceBy::LookupId(format!("payment_method_{payment_method_id}")), ) .await } @@ -93,7 +93,7 @@ impl PaymentMethodInterface for KVRouterStore { key_store, storage_scheme, PaymentMethod::find_by_locker_id(&conn, locker_id), - FindResourceBy::LookupId(format!("payment_method_locker_{}", locker_id)), + FindResourceBy::LookupId(format!("payment_method_locker_{locker_id}")), ) .await } @@ -165,7 +165,7 @@ impl PaymentMethodInterface for KVRouterStore { let lookup_id1 = format!("payment_method_{}", payment_method_new.get_id()); let mut reverse_lookups = vec![lookup_id1]; if let Some(locker_id) = &payment_method_new.locker_id { - reverse_lookups.push(format!("payment_method_locker_{}", locker_id)) + reverse_lookups.push(format!("payment_method_locker_{locker_id}")) } let payment_method = (&payment_method_new.clone()).into(); self.insert_resource( diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs index 78531b78ad..5de811b6a9 100644 --- a/crates/storage_impl/src/payments/payment_attempt.rs +++ b/crates/storage_impl/src/payments/payment_attempt.rs @@ -2171,7 +2171,7 @@ async fn add_connector_txn_id_to_reverse_lookup( connector_transaction_id: &str, storage_scheme: MerchantStorageScheme, ) -> CustomResult { - let field = format!("pa_{}", updated_attempt_attempt_id); + let field = format!("pa_{updated_attempt_attempt_id}"); let reverse_lookup_new = ReverseLookupNew { lookup_id: format!( "pa_conn_trans_{}_{}", @@ -2198,7 +2198,7 @@ async fn add_preprocessing_id_to_reverse_lookup( preprocessing_id: &str, storage_scheme: MerchantStorageScheme, ) -> CustomResult { - let field = format!("pa_{}", updated_attempt_attempt_id); + let field = format!("pa_{updated_attempt_attempt_id}"); let reverse_lookup_new = ReverseLookupNew { lookup_id: format!( "pa_preprocessing_{}_{}", @@ -2224,10 +2224,7 @@ mod label { profile_id: &str, connector_transaction_id: &str, ) -> String { - format!( - "profile_{}_conn_txn_{}", - profile_id, connector_transaction_id - ) + format!("profile_{profile_id}_conn_txn_{connector_transaction_id}") } pub(super) fn get_global_id_label( diff --git a/crates/storage_impl/src/payouts/payout_attempt.rs b/crates/storage_impl/src/payouts/payout_attempt.rs index 35939c1132..a81fac45e9 100644 --- a/crates/storage_impl/src/payouts/payout_attempt.rs +++ b/crates/storage_impl/src/payouts/payout_attempt.rs @@ -732,7 +732,7 @@ async fn add_connector_payout_id_to_reverse_lookup( connector_payout_id: &str, storage_scheme: MerchantStorageScheme, ) -> CustomResult { - let field = format!("poa_{}", updated_attempt_attempt_id); + let field = format!("poa_{updated_attempt_attempt_id}"); let reverse_lookup_new = ReverseLookupNew { lookup_id: format!( "po_conn_payout_{}_{}", diff --git a/crates/storage_impl/src/redis/kv_store.rs b/crates/storage_impl/src/redis/kv_store.rs index e7c47c5899..d190329a4b 100644 --- a/crates/storage_impl/src/redis/kv_store.rs +++ b/crates/storage_impl/src/redis/kv_store.rs @@ -113,7 +113,7 @@ impl std::fmt::Display for PartitionKey<'_> { )), #[cfg(feature = "v2")] - PartitionKey::GlobalId { id } => f.write_str(&format!("global_cust_{id}",)), + PartitionKey::GlobalId { id } => f.write_str(&format!("global_cust_{id}")), #[cfg(feature = "v2")] PartitionKey::GlobalPaymentId { id } => { f.write_str(&format!("global_payment_{}", id.get_string_repr())) @@ -177,7 +177,7 @@ where { let redis_conn = store.get_redis_conn()?; - let key = format!("{}", partition_key); + let key = format!("{partition_key}"); let type_name = std::any::type_name::(); let operation = op.to_string(); @@ -293,7 +293,7 @@ impl std::fmt::Display for Op<'_> { Op::Insert => f.write_str("insert"), Op::Find => f.write_str("find"), Op::Update(p_key, _, updated_by) => { - f.write_str(&format!("update_{} for updated_by_{:?}", p_key, updated_by)) + f.write_str(&format!("update_{p_key} for updated_by_{updated_by:?}")) } } } diff --git a/crates/test_utils/src/newman_runner.rs b/crates/test_utils/src/newman_runner.rs index a7651f8138..096dec8254 100644 --- a/crates/test_utils/src/newman_runner.rs +++ b/crates/test_utils/src/newman_runner.rs @@ -340,11 +340,11 @@ pub fn check_for_custom_headers(headers: Option>, path: &str) -> Opt eprintln!("An error occurred while inserting the custom header: {err}"); } } else { - eprintln!("Invalid header format: {}", header); + eprintln!("Invalid header format: {header}"); } } - return Some(format!("{}/event.prerequest.js", path)); + return Some(format!("{path}/event.prerequest.js")); } None } @@ -400,8 +400,7 @@ pub fn remove_quotes_for_integer_values( let mut contents = fs::read_to_string(&collection_path)?; for value_to_replace in values_to_replace { if let Ok(re) = Regex::new(&format!( - r#"\\"(?P\{{\{{{}\}}\}})\\""#, - value_to_replace + r#"\\"(?P\{{\{{{value_to_replace}\}}\}})\\""#, )) { contents = re.replace_all(&contents, "$field").to_string(); } else { @@ -440,7 +439,7 @@ pub fn export_collection(connector_name: &str, collection_dir_path: String) { } } Err(err) => { - eprintln!("Failed to execute dir-import: {:?}", err); + eprintln!("Failed to execute dir-import: {err:?}"); exit(1); } } diff --git a/crates/test_utils/tests/connectors/selenium.rs b/crates/test_utils/tests/connectors/selenium.rs index f29e58a12d..fb2b113867 100644 --- a/crates/test_utils/tests/connectors/selenium.rs +++ b/crates/test_utils/tests/connectors/selenium.rs @@ -889,7 +889,7 @@ fn get_firefox_profile_path() -> Result { } else if env::consts::OS == "linux" { if let Some(home_dir) = env::var_os("HOME") { if let Some(home_path) = home_dir.to_str() { - let profile_path = format!("{}/.mozilla/firefox/hs-test", home_path); + let profile_path = format!("{home_path}/.mozilla/firefox/hs-test"); return Ok(profile_path); } } @@ -911,12 +911,12 @@ pub fn handle_test_error( match res { Ok(Ok(_)) => true, Ok(Err(web_driver_error)) => { - eprintln!("test future failed to resolve: {:?}", web_driver_error); + eprintln!("test future failed to resolve: {web_driver_error:?}"); false } Err(e) => { if let Some(web_driver_error) = e.downcast_ref::() { - eprintln!("test future panicked: {:?}", web_driver_error); + eprintln!("test future panicked: {web_driver_error:?}"); } else { eprintln!("test future panicked; an assertion probably failed"); }