chore: update format! macro use to satisfy latest clippy version (#194)

This commit is contained in:
Louise Poole
2025-04-25 17:13:01 +02:00
committed by GitHub
parent 9740c92129
commit f29de67f1f
38 changed files with 1379 additions and 1698 deletions

View File

@@ -26,10 +26,10 @@ fn main() -> Result<()> {
let contract_name = file_name.split('.').next().unwrap();
let input_path = format!("{}/{}", abi_folder, file_name);
let output_path = format!("{}/{}.rs", output_folder, contract_name);
let input_path = format!("{abi_folder}/{file_name}");
let output_path = format!("{output_folder}/{contract_name}.rs");
mod_rs_content.push_str(&format!("pub mod {};\n", contract_name));
mod_rs_content.push_str(&format!("pub mod {contract_name};\n"));
if std::path::Path::new(&output_path).exists() {
continue;
@@ -40,7 +40,7 @@ fn main() -> Result<()> {
.write_to_file(&output_path)?;
}
let mod_rs_path = format!("{}/mod.rs", output_folder);
let mod_rs_path = format!("{output_folder}/mod.rs");
let mut mod_rs_file = fs::File::create(mod_rs_path)?;
mod_rs_file.write_all(mod_rs_content.as_bytes())?;

View File

@@ -39,7 +39,7 @@ fn address_to_bytes_with_0x(address: &[u8; 20]) -> Vec<u8> {
/// Converts address bytes into a string containing a leading `0x`.
fn address_to_string_with_0x(address: &[u8]) -> String {
format!("0x{}", hex::encode(address))
format!("0x{encoded}", encoded = hex::encode(address))
}
/// Function that swaps `WETH` addresses for `ETH` address for specific factory types that decide
@@ -499,8 +499,8 @@ pub fn address_map(
name: "stateless_contract_addr_0".into(),
// Call views_implementation() on CRYPTO_SWAP_NG_FACTORY
value: format!(
"call:0x{}:views_implementation()",
hex::encode(CRYPTO_SWAP_NG_FACTORY)
"call:0x{factory}:views_implementation()",
factory = hex::encode(CRYPTO_SWAP_NG_FACTORY)
)
.into(),
change: ChangeType::Creation.into(),
@@ -579,8 +579,8 @@ pub fn address_map(
name: "stateless_contract_addr_0".into(),
// Call views_implementation() on CRYPTO_SWAP_NG_FACTORY
value: format!(
"call:0x{}:views_implementation()",
hex::encode(CRYPTO_SWAP_NG_FACTORY)
"call:0x{factory}:views_implementation()",
factory = hex::encode(CRYPTO_SWAP_NG_FACTORY)
)
.into(),
change: ChangeType::Creation.into(),
@@ -589,8 +589,8 @@ pub fn address_map(
name: "stateless_contract_addr_1".into(),
// Call math_implementation() on CRYPTO_SWAP_NG_FACTORY
value: format!(
"call:0x{}:math_implementation()",
hex::encode(CRYPTO_SWAP_NG_FACTORY)
"call:0x{factory}:math_implementation()",
factory = hex::encode(CRYPTO_SWAP_NG_FACTORY)
)
.into(),
change: ChangeType::Creation.into(),
@@ -651,14 +651,14 @@ pub fn address_map(
}),
},
vec![EntityChanges {
component_id: format!("0x{}", id),
component_id: format!("0x{id}"),
attributes: vec![
Attribute {
name: "stateless_contract_addr_0".into(),
// Call views_implementation() on TRICRYPTO_FACTORY
value: format!(
"call:0x{}:views_implementation()",
hex::encode(TRICRYPTO_FACTORY)
"call:0x{factory}:views_implementation()",
factory = hex::encode(TRICRYPTO_FACTORY)
)
.into(),
change: ChangeType::Creation.into(),
@@ -667,8 +667,8 @@ pub fn address_map(
name: "stateless_contract_addr_1".into(),
// Call math_implementation() on TRICRYPTO_FACTORY
value: format!(
"call:0x{}:math_implementation()",
hex::encode(TRICRYPTO_FACTORY)
"call:0x{factory}:math_implementation()",
factory = hex::encode(TRICRYPTO_FACTORY)
)
.into(),
change: ChangeType::Creation.into(),
@@ -907,14 +907,14 @@ pub fn address_map(
}),
},
vec![EntityChanges {
component_id: format!("0x{}", id),
component_id: format!("0x{id}"),
attributes: vec![
Attribute {
name: "stateless_contract_addr_0".into(),
// Call views_implementation() on TWOCRYPTO_FACTORY
value: format!(
"call:0x{}:views_implementation()",
hex::encode(TWOCRYPTO_FACTORY)
"call:0x{factory}:views_implementation()",
factory = hex::encode(TWOCRYPTO_FACTORY)
)
.into(),
change: ChangeType::Creation.into(),

View File

@@ -99,7 +99,7 @@ fn create_component(
}),
},
vec![EntityChanges {
component_id: format!("0x{}", pool.address.clone()),
component_id: format!("0x{pool_address}", pool_address = pool.address.clone()),
attributes: zip(
pool.attribute_keys
.clone()
@@ -127,7 +127,7 @@ fn parse_params(params: &str) -> Result<HashMap<String, PoolQueryParams>, anyhow
.split(PARAMS_SEPERATOR)
.map(|param| {
let pool: PoolQueryParams = serde_qs::from_str(param)
.with_context(|| format!("Failed to parse pool query params: {0}", param))?;
.with_context(|| format!("Failed to parse pool query params: {param}"))?;
Ok((pool.tx_hash.clone(), pool))
})
.collect::<Result<HashMap<_, _>>>()