mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	chore: address Rust 1.78 clippy lints (#4545)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
		| @ -456,7 +456,7 @@ pub struct MerchantConnectorCreate { | ||||
|     pub disabled: Option<bool>, | ||||
|  | ||||
|     /// Contains the frm configs for the merchant connector | ||||
|     #[schema(example = json!(common_utils::consts::FRM_CONFIGS_EG))] | ||||
|     #[schema(example = json!(consts::FRM_CONFIGS_EG))] | ||||
|     pub frm_configs: Option<Vec<FrmConfigs>>, | ||||
|  | ||||
|     /// The business country to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead | ||||
| @ -609,7 +609,7 @@ pub struct MerchantConnectorResponse { | ||||
|     pub disabled: Option<bool>, | ||||
|  | ||||
|     /// Contains the frm configs for the merchant connector | ||||
|     #[schema(example = json!(common_utils::consts::FRM_CONFIGS_EG))] | ||||
|     #[schema(example = json!(consts::FRM_CONFIGS_EG))] | ||||
|     pub frm_configs: Option<Vec<FrmConfigs>>, | ||||
|  | ||||
|     /// The business country to which the connector account is attached. To be deprecated soon. Use the 'profile_id' instead | ||||
| @ -702,7 +702,7 @@ pub struct MerchantConnectorUpdate { | ||||
|     pub disabled: Option<bool>, | ||||
|  | ||||
|     /// Contains the frm configs for the merchant connector | ||||
|     #[schema(example = json!(common_utils::consts::FRM_CONFIGS_EG))] | ||||
|     #[schema(example = json!(consts::FRM_CONFIGS_EG))] | ||||
|     pub frm_configs: Option<Vec<FrmConfigs>>, | ||||
|  | ||||
|     pub pm_auth_config: Option<serde_json::Value>, | ||||
|  | ||||
| @ -270,7 +270,7 @@ mod api_key_expiration_tests { | ||||
|         let date = time::Date::from_calendar_date(2022, time::Month::September, 10).unwrap(); | ||||
|         let time = time::Time::from_hms(11, 12, 13).unwrap(); | ||||
|         assert_eq!( | ||||
|             serde_json::to_string(&ApiKeyExpiration::DateTime(time::PrimitiveDateTime::new( | ||||
|             serde_json::to_string(&ApiKeyExpiration::DateTime(PrimitiveDateTime::new( | ||||
|                 date, time | ||||
|             ))) | ||||
|             .unwrap(), | ||||
| @ -289,7 +289,7 @@ mod api_key_expiration_tests { | ||||
|         let time = time::Time::from_hms(11, 12, 13).unwrap(); | ||||
|         assert_eq!( | ||||
|             serde_json::from_str::<ApiKeyExpiration>(r#""2022-09-10T11:12:13.000Z""#).unwrap(), | ||||
|             ApiKeyExpiration::DateTime(time::PrimitiveDateTime::new(date, time)) | ||||
|             ApiKeyExpiration::DateTime(PrimitiveDateTime::new(date, time)) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -682,7 +682,7 @@ impl PaymentsRequest { | ||||
|             .as_ref() | ||||
|             .map(|od| { | ||||
|                 od.iter() | ||||
|                     .map(|order| order.encode_to_value().map(masking::Secret::new)) | ||||
|                     .map(|order| order.encode_to_value().map(Secret::new)) | ||||
|                     .collect::<Result<Vec<_>, _>>() | ||||
|             }) | ||||
|             .transpose() | ||||
| @ -1304,9 +1304,7 @@ mod payment_method_data_serde { | ||||
|         match deserialize_to_inner { | ||||
|             __Inner::OptionalPaymentMethod(value) => { | ||||
|                 let parsed_value = serde_json::from_value::<__InnerPaymentMethodData>(value) | ||||
|                     .map_err(|serde_json_error| { | ||||
|                         serde::de::Error::custom(serde_json_error.to_string()) | ||||
|                     })?; | ||||
|                     .map_err(|serde_json_error| de::Error::custom(serde_json_error.to_string()))?; | ||||
|  | ||||
|                 let payment_method_data = if let Some(payment_method_data_value) = | ||||
|                     parsed_value.payment_method_data | ||||
| @ -1321,14 +1319,12 @@ mod payment_method_data_serde { | ||||
|                                     payment_method_data_value, | ||||
|                                 ) | ||||
|                                 .map_err(|serde_json_error| { | ||||
|                                     serde::de::Error::custom(serde_json_error.to_string()) | ||||
|                                     de::Error::custom(serde_json_error.to_string()) | ||||
|                                 })?, | ||||
|                             ) | ||||
|                         } | ||||
|                     } else { | ||||
|                         Err(serde::de::Error::custom( | ||||
|                             "Expected a map for payment_method_data", | ||||
|                         ))? | ||||
|                         Err(de::Error::custom("Expected a map for payment_method_data"))? | ||||
|                     } | ||||
|                 } else { | ||||
|                     None | ||||
| @ -1342,7 +1338,7 @@ mod payment_method_data_serde { | ||||
|             __Inner::RewardString(inner_string) => { | ||||
|                 let payment_method_data = match inner_string.as_str() { | ||||
|                     "reward" => PaymentMethodData::Reward, | ||||
|                     _ => Err(serde::de::Error::custom("Invalid Variant"))?, | ||||
|                     _ => Err(de::Error::custom("Invalid Variant"))?, | ||||
|                 }; | ||||
|  | ||||
|                 Ok(Some(PaymentMethodDataRequest { | ||||
| @ -2686,8 +2682,8 @@ pub enum PaymentIdType { | ||||
|     PreprocessingId(String), | ||||
| } | ||||
|  | ||||
| impl std::fmt::Display for PaymentIdType { | ||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||
| impl fmt::Display for PaymentIdType { | ||||
|     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||||
|         match self { | ||||
|             Self::PaymentIntentId(payment_id) => { | ||||
|                 write!(f, "payment_intent_id = \"{payment_id}\"") | ||||
|  | ||||
| @ -203,8 +203,8 @@ pub struct RoutableConnectorChoice { | ||||
|     pub sub_label: Option<String>, | ||||
| } | ||||
|  | ||||
| impl ToString for RoutableConnectorChoice { | ||||
|     fn to_string(&self) -> String { | ||||
| impl std::fmt::Display for RoutableConnectorChoice { | ||||
|     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||
|         #[cfg(feature = "connector_choice_mca_id")] | ||||
|         let base = self.connector.to_string(); | ||||
|  | ||||
| @ -219,7 +219,7 @@ impl ToString for RoutableConnectorChoice { | ||||
|             sub_base | ||||
|         }; | ||||
|  | ||||
|         base | ||||
|         write!(f, "{}", base) | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -329,7 +329,7 @@ pub enum RoutingAlgorithm { | ||||
|     Priority(Vec<RoutableConnectorChoice>), | ||||
|     VolumeSplit(Vec<ConnectorVolumeSplit>), | ||||
|     #[schema(value_type=ProgramConnectorSelection)] | ||||
|     Advanced(euclid::frontend::ast::Program<ConnectorSelection>), | ||||
|     Advanced(ast::Program<ConnectorSelection>), | ||||
| } | ||||
|  | ||||
| #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] | ||||
| @ -338,7 +338,7 @@ pub enum RoutingAlgorithmSerde { | ||||
|     Single(Box<RoutableConnectorChoice>), | ||||
|     Priority(Vec<RoutableConnectorChoice>), | ||||
|     VolumeSplit(Vec<ConnectorVolumeSplit>), | ||||
|     Advanced(euclid::frontend::ast::Program<ConnectorSelection>), | ||||
|     Advanced(ast::Program<ConnectorSelection>), | ||||
| } | ||||
|  | ||||
| impl TryFrom<RoutingAlgorithmSerde> for RoutingAlgorithm { | ||||
|  | ||||
| @ -33,7 +33,7 @@ pub enum SetMetaDataRequest { | ||||
| pub struct ProductionAgreementRequest { | ||||
|     pub version: String, | ||||
|     #[serde(skip_deserializing)] | ||||
|     pub ip_address: Option<Secret<String, common_utils::pii::IpAddress>>, | ||||
|     pub ip_address: Option<Secret<String, pii::IpAddress>>, | ||||
| } | ||||
|  | ||||
| #[derive(Debug, serde::Deserialize, serde::Serialize)] | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Chethan Rao
					Chethan Rao