ソースを参照

explorer: chore clippy

skoupidi 1 年間 前
コミット
464258698d

+ 8 - 9
bin/explorer/explorerd/src/config.rs

@@ -48,21 +48,20 @@ impl ExplorerConfig {
         // Load the configuration file from the specified path
         let config_content = load_file(Path::new(&config_path)).map_err(|err| {
             Error::ConfigError(format!(
-                "Failed to read the configuration file {}: {:?}",
-                config_path, err
+                "Failed to read the configuration file {config_path}: {err:?}"
             ))
         })?;
 
         // Parse the loaded content into a configuration instance
         let mut config = toml::from_str::<Self>(&config_content).map_err(|e| {
-            error!(target: "explorerd::config", "Failed parsing TOML config: {}", e);
-            Error::ConfigError(format!("Failed to parse the configuration file {}", config_path))
+            error!(target: "explorerd::config", "Failed parsing TOML config: {e}");
+            Error::ConfigError(format!("Failed to parse the configuration file {config_path}"))
         })?;
 
         // Set the configuration path
         config.path = Some(config_path);
 
-        debug!(target: "explorerd::config", "Successfully loaded configuration: {:?}", config);
+        debug!(target: "explorerd::config", "Successfully loaded configuration: {config:?}");
 
         Ok(config)
     }
@@ -113,7 +112,7 @@ impl FromStr for ExplorerConfig {
     type Err = String;
     fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
         let config: ExplorerConfig =
-            toml::from_str(s).map_err(|e| format!("Failed to parse ExplorerdConfig: {}", e))?;
+            toml::from_str(s).map_err(|e| format!("Failed to parse ExplorerdConfig: {e}"))?;
         Ok(config)
     }
 }
@@ -145,7 +144,7 @@ impl FromStr for NetworkConfigs {
     type Err = String;
     fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
         let config: NetworkConfigs =
-            toml::from_str(s).map_err(|e| format!("Failed to parse NetworkConfigs: {}", e))?;
+            toml::from_str(s).map_err(|e| format!("Failed to parse NetworkConfigs: {e}"))?;
         Ok(config)
     }
 }
@@ -211,7 +210,7 @@ impl FromStr for ExplorerNetworkConfig {
     type Err = String;
     fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
         let config: ExplorerNetworkConfig = toml::from_str(s)
-            .map_err(|e| format!("Failed to parse ExplorerdNetworkConfig: {}", e))?;
+            .map_err(|e| format!("Failed to parse ExplorerdNetworkConfig: {e}"))?;
         Ok(config)
     }
 }
@@ -287,7 +286,7 @@ mod tests {
                 assert_eq!(config.endpoint.to_string(), expected_endpoint);
                 assert_eq!(config.rpc.rpc_listen.to_string(), expected_rpc);
             } else {
-                assert!(network_config.is_none(), "{} configuration is missing", network);
+                assert!(network_config.is_none(), "{network} configuration is missing");
             }
         }
 

+ 3 - 3
bin/explorer/explorerd/src/error.rs

@@ -86,8 +86,8 @@ pub fn server_error(e: &ExplorerdError, id: u16, msg: Option<&str>) -> JsonError
 /// Logs and converts a database error into a [`DatabaseError`].
 /// This function ensures the error is logged contextually before being returned.
 pub fn handle_database_error(target: &str, message: &str, error: impl fmt::Debug) -> Error {
-    let error_message = format!("{}: {:?}", message, error);
-    let formatted_target = format!("explorerd::{}", target);
-    error!(target: &formatted_target, "{}", error_message);
+    let error_message = format!("{message}: {error:?}");
+    let formatted_target = format!("explorerd::{target}");
+    error!(target: &formatted_target, "{error_message}");
     Error::DatabaseError(error_message)
 }

+ 4 - 4
bin/explorer/explorerd/src/main.rs

@@ -171,7 +171,7 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
             match res {
                 Ok(()) | Err(Error::RpcServerStopped) => explorer_.stop_connections().await,
                 Err(e) => {
-                    error!(target: "explorerd", "Failed starting sync JSON-RPC server: {}", e)
+                    error!(target: "explorerd", "Failed starting sync JSON-RPC server: {e}")
                 }
             }
         },
@@ -230,7 +230,7 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
 async fn sync_blocks(explorer: Arc<Explorerd>, reset: bool) -> Result<()> {
     info!(target: "explorerd", "Syncing blocks from darkfid...");
     if let Err(e) = explorer.service.sync_blocks(reset).await {
-        let error_message = format!("Error syncing blocks: {:?}", e);
+        let error_message = format!("Error syncing blocks: {e:?}");
         error!(target: "explorerd", "{error_message}");
         return Err(Error::DatabaseError(error_message));
     }
@@ -257,7 +257,7 @@ async fn subscribe_blocks(
                 sync_blocks(explorer.clone(), reset).await?;
                 subscribe_sync_blocks(explorer.clone(), endpoint.clone(), executor.clone()).await
             } else {
-                let error_message = format!("Error setting up blocks subscriber: {:?}", e);
+                let error_message = format!("Error setting up blocks subscriber: {e:?}");
                 error!(target: "explorerd", "{error_message}");
                 return Err(Error::DatabaseError(error_message));
             }
@@ -297,6 +297,6 @@ fn log_started_banner(
     info!(target: "explorerd", "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
     info!(target: "explorerd", "  - Synced Blocks: {}", explorer.service.db.blockchain.len());
     info!(target: "explorerd", "  - Synced Transactions: {}", explorer.service.db.blockchain.len());
-    info!(target: "explorerd", "  - Connected Darkfi Node: {}", connected_node);
+    info!(target: "explorerd", "  - Connected Darkfi Node: {connected_node}");
     info!(target: "explorerd", "========================================================================================");
 }

+ 4 - 4
bin/explorer/explorerd/src/rpc/blocks.rs

@@ -192,7 +192,7 @@ mod tests {
                 rpc_method,
                 &[],
                 ErrorCode::InvalidParams.code(),
-                &format!("Parameter '{}' at index 0 is missing", parameter_name),
+                &format!("Parameter '{parameter_name}' at index 0 is missing"),
             )
             .await;
 
@@ -202,7 +202,7 @@ mod tests {
                 rpc_method,
                 &[JsonValue::String("invalid_number".to_string())],
                 ErrorCode::InvalidParams.code(),
-                &format!("Parameter '{}' is not a supported number type", parameter_name),
+                &format!("Parameter '{parameter_name}' is not a supported number type"),
             )
             .await;
         });
@@ -228,7 +228,7 @@ mod tests {
                 rpc_method,
                 &[],
                 ErrorCode::InvalidParams.code(),
-                &format!("Parameter '{}' at index 0 is missing", start_parameter_name),
+                &format!("Parameter '{start_parameter_name}' at index 0 is missing"),
             )
             .await;
 
@@ -248,7 +248,7 @@ mod tests {
                 rpc_method,
                 &[JsonValue::Number(10.0)],
                 ErrorCode::InvalidParams.code(),
-                &format!("Parameter '{}' at index 1 is missing", end_parameter_name),
+                &format!("Parameter '{end_parameter_name}' at index 1 is missing"),
             )
             .await;
 

+ 2 - 2
bin/explorer/explorerd/src/rpc/contracts.rs

@@ -177,7 +177,7 @@ mod tests {
                 test_method,
                 &[JsonValue::String("BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o".to_string())],
                 ErrorCode::InvalidParams.code(),
-                &format!("Parameter '{}' at index 1 is missing", parameter_name),
+                &format!("Parameter '{parameter_name}' at index 1 is missing"),
             )
             .await;
 
@@ -190,7 +190,7 @@ mod tests {
                     JsonValue::Number(123.0), // Invalid `source_path` type
                 ],
                 ErrorCode::InvalidParams.code(),
-                &format!("Parameter '{}' is not a valid string", parameter_name),
+                &format!("Parameter '{parameter_name}' is not a valid string"),
             )
             .await;
         });

+ 7 - 7
bin/explorer/explorerd/src/rpc/mod.rs

@@ -260,13 +260,13 @@ impl DarkfidRpcClient {
         let rpc_client_guard = self.rpc_client.read().await;
 
         if let Some(ref rpc_client) = *rpc_client_guard {
-            debug!(target: "explorerd::rpc::request", "Executing request {} with params: {:?}", method, params);
+            debug!(target: "explorerd::rpc::request", "Executing request {method} with params: {params:?}");
             let latency = Instant::now();
             let req = JsonRequest::new(method, params.clone());
             let rep = rpc_client.request(req).await?;
             let latency = latency.elapsed();
-            trace!(target: "explorerd::rpc::request", "Got reply: {:?}", rep);
-            debug!(target: "explorerd::rpc::request", "Latency: {:?}", latency);
+            trace!(target: "explorerd::rpc::request", "Got reply: {rep:?}");
+            debug!(target: "explorerd::rpc::request", "Latency: {latency:?}");
             return Ok(rep);
         };
 
@@ -319,25 +319,25 @@ impl Explorerd {
 /// and error, and performs the log operation without returning a value.
 fn log_request_failure(req_method: &str, params: &JsonValue, error: &JsonError) {
     // Generate the log target based on request
-    let log_target = format!("explorerd::rpc::handle_request::{}", req_method);
+    let log_target = format!("explorerd::rpc::handle_request::{req_method}");
 
     // Stringify the params
     let params_stringified = match params.stringify() {
         Ok(params) => params,
-        Err(e) => format!("Failed to stringify params: {:?}", e),
+        Err(e) => format!("Failed to stringify params: {e:?}"),
     };
 
     // Stringfy the error
     let error_stringified = match error.stringify() {
         Ok(err_str) => err_str,
-        Err(e) => format!("Failed to stringify error: {:?}", e),
+        Err(e) => format!("Failed to stringify error: {e:?}"),
     };
 
     // Format the error message for the log
     let error_message = format!("RPC Request Failure: method: {req_method}, params: {params_stringified}, error: {error_stringified}");
 
     // Log the error
-    error!(target: &log_target, "{}", error_message);
+    error!(target: &log_target, "{error_message}");
 }
 
 /// Test module for validating API functions within this `mod.rs` file. It ensures that the core API

+ 1 - 1
bin/explorer/explorerd/src/service/blocks.rs

@@ -199,7 +199,7 @@ impl ExplorerService {
         // Add the block and commit the changes to persist it
         let _ = blockchain_overlay.lock().unwrap().add_block(block)?;
         blockchain_overlay.lock().unwrap().overlay.lock().unwrap().apply()?;
-        debug!(target: "explorerd::blocks::put_block", "Added block {:?}", block);
+        debug!(target: "explorerd::blocks::put_block", "Added block {block:?}");
 
         Ok(())
     }

+ 5 - 8
bin/explorer/explorerd/src/service/contracts.rs

@@ -172,7 +172,7 @@ impl ExplorerService {
 
             // Add source code into the `ContractMetaStore`
             self.db.contract_meta_store.insert_source(contract_id, &source_code)?;
-            info!(target: "explorerd: load_native_contract_sources", "Loaded native contract source {}", contract_id_str);
+            info!(target: "explorerd: load_native_contract_sources", "Loaded native contract source {contract_id_str}");
         }
         Ok(())
     }
@@ -497,8 +497,7 @@ mod tests {
         // Verify actual source matches expected result
         assert_eq!(
             expected_source_paths, actual_source_paths,
-            "Mismatch between expected and actual source paths for tar file: {}",
-            tar_file
+            "Mismatch between expected and actual source paths for tar file: {tar_file}"
         );
 
         Ok(())
@@ -525,8 +524,7 @@ mod tests {
             // Verify source content exists
             assert!(
                 actual_source.is_some(),
-                "Actual source `{}` is missing in the store.",
-                file_path
+                "Actual source `{file_path}` is missing in the store."
             );
 
             // Read the source content from the tar archive
@@ -536,8 +534,7 @@ mod tests {
             assert_eq!(
                 actual_source.unwrap(),
                 expected_source,
-                "Actual source does not match expected results `{}`.",
-                file_path
+                "Actual source does not match expected results `{file_path}`."
             );
         }
 
@@ -559,7 +556,7 @@ mod tests {
             }
         }
 
-        Err(Custom(format!("File {} not found in tar archive.", file_path)))
+        Err(Custom(format!("File {file_path} not found in tar archive.")))
     }
 
     /// Auxiliary function that extracts all file paths from the given `tar_bytes` tar archive.

+ 3 - 6
bin/explorer/explorerd/src/service/statistics.rs

@@ -93,8 +93,7 @@ impl ExplorerService {
             // Throw database error if last_block retrievals fails
             .map_err(|e| {
                 Error::DatabaseError(format!(
-                    "[get_base_statistics] Retrieving last block failed: {:?}",
-                    e
+                    "[get_base_statistics] Retrieving last block failed: {e:?}"
                 ))
             })?
             // Calculate base statistics and return result
@@ -112,8 +111,7 @@ impl ExplorerService {
         // Fetch all metrics from the metrics store, handling any potential errors
         let metrics = self.db.metrics_store.get_all_metrics().map_err(|e| {
             Error::DatabaseError(format!(
-                "[get_metrics_statistics] Retrieving metrics failed: {:?}",
-                e
+                "[get_metrics_statistics] Retrieving metrics failed: {e:?}"
             ))
         })?;
 
@@ -130,8 +128,7 @@ impl ExplorerService {
         // Fetch the latest metrics, handling any potential errors
         match self.db.metrics_store.get_last().map_err(|e| {
             Error::DatabaseError(format!(
-                "[get_metrics_statistics] Retrieving latest metrics failed: {:?}",
-                e
+                "[get_metrics_statistics] Retrieving latest metrics failed: {e:?}"
             ))
         })? {
             // Transform metrics into `MetricStatistics` when found

+ 3 - 5
bin/explorer/explorerd/src/service/sync.rs

@@ -167,8 +167,7 @@ impl ExplorerService {
 
         info!(
             target: "explorerd::rpc_blocks::sync_blocks",
-            "Synced {} blocks: explorer blocks total {} [{}]",
-            blocks_synced,
+            "Synced {blocks_synced} blocks: explorer blocks total {} [{}]",
             self.db.blockchain.blocks.len(),
             fmt_duration(sync_start_time.elapsed()),
         );
@@ -204,7 +203,7 @@ impl ExplorerService {
         // Search for an explorer block that matches a darkfi node block
         while cur_height > 0 {
             let synced_block = self.get_block_by_height(cur_height)?;
-            debug!(target: "explorerd::rpc_blocks::process_sync_blocks_reorg", "Searching for common block: {}", cur_height);
+            debug!(target: "explorerd::rpc_blocks::process_sync_blocks_reorg", "Searching for common block: {cur_height}");
 
             // Check if we found a synced block for current height being searched
             if let Some(synced_block) = synced_block {
@@ -224,8 +223,7 @@ impl ExplorerService {
                             if cur_height == last_synced_height {
                                 info!(
                                     target: "explorerd::rpc_blocks::process_sync_blocks_reorg",
-                                    "Reorg detected at height {}: explorer.{} != darkfid.{}",
-                                    cur_height,
+                                    "Reorg detected at height {cur_height}: explorer.{} != darkfid.{}",
                                     synced_block.header_hash,
                                     darkfid_block.hash()
                                 );

+ 5 - 7
bin/explorer/explorerd/src/service/transactions.rs

@@ -313,7 +313,7 @@ impl ExplorerService {
             if decoder.position() != metadata.len() as u64 {
                 error!(
                     target: "block_explorer::calculate_tx_gas_data",
-                    "[BLOCK_EXPLORER] Failed decoding entire metadata buffer for {}:{}", tx_hash, idx,
+                    "[BLOCK_EXPLORER] Failed decoding entire metadata buffer for {tx_hash}:{idx}"
                 );
                 return Err(TxVerifyFailed::ErroneousTxs(vec![tx.clone()]).into())
             }
@@ -404,7 +404,7 @@ impl ExplorerService {
                 Err(e) => {
                     error!(
                         target: "block_explorer::calculate_tx_gas_data",
-                        "[VALIDATOR] Failed deserializing tx {} fee call: {}", tx_hash, e,
+                        "[VALIDATOR] Failed deserializing tx {tx_hash} fee call: {e}"
                     );
                     return Err(TxVerifyFailed::InvalidFee.into())
                 }
@@ -415,12 +415,10 @@ impl ExplorerService {
             if total_gas_used > fee {
                 error!(
                     target: "block_explorer::calculate_tx_gas_data",
-                    "[VALIDATOR] Transaction {} has insufficient fee. Required: {}, Paid: {}",
-                    tx_hash, total_gas_used, fee,
-                );
+                    "[VALIDATOR] Transaction {tx_hash} has insufficient fee. Required: {total_gas_used}, Paid: {fee}");
                 return Err(TxVerifyFailed::InsufficientFee.into())
             }
-            debug!(target: "block_explorer::calculate_tx_gas_data", "The gas paid for transaction {}: {}", tx_hash, gas_paid);
+            debug!(target: "block_explorer::calculate_tx_gas_data", "The gas paid for transaction {tx_hash}: {gas_paid}");
 
             // Store paid fee
             gas_paid = fee;
@@ -437,7 +435,7 @@ impl ExplorerService {
             deployments: deploy_gas_used,
         };
 
-        debug!(target: "block_explorer::calculate_tx_gas_data", "The total gas usage for transaction {}: {:?}", tx_hash, fee_data);
+        debug!(target: "block_explorer::calculate_tx_gas_data", "The total gas usage for transaction {tx_hash}: {fee_data:?}");
 
         Ok(fee_data)
     }

+ 9 - 10
bin/explorer/explorerd/src/store/contract_metadata.rs

@@ -104,7 +104,7 @@ impl ContractMetaStore {
     /// the given contract ID are included. Returns a `Vec` of [`String`]
     /// representing source code paths.
     pub fn get_source_paths(&self, contract_id: &ContractId) -> Result<Vec<String>> {
-        let prefix = format!("{}/", contract_id);
+        let prefix = format!("{contract_id}/");
 
         // Get all the source paths for provided `ContractId`
         let mut entries = self
@@ -129,7 +129,7 @@ impl ContractMetaStore {
         contract_id: &ContractId,
         source_path: &str,
     ) -> Result<Option<String>> {
-        let key = format!("{}/{}", contract_id, source_path);
+        let key = format!("{contract_id}/{source_path}");
         match self.source_code.get(key.as_bytes())? {
             Some(ivec) => Ok(Some(String::from_utf8(ivec.to_vec()).map_err(|e| {
                 Error::Custom(format!(
@@ -214,14 +214,14 @@ impl ContractMetadataStoreOverlay {
         // Insert each source code file
         for source_file in source.iter() {
             // Create key by pre-pending contract id to the source code path
-            let key = format!("{}/{}", contract_id, source_file.path);
+            let key = format!("{contract_id}/{}", source_file.path);
             // Insert the source code
             lock.insert(
                 SLED_CONTRACT_SOURCE_CODE_TREE,
                 key.as_bytes(),
                 source_file.content.as_bytes(),
             )?;
-            debug!(target: "explorerd::contract_meta_store::insert_source", "Inserted contract source for path {}", key);
+            debug!(target: "explorerd::contract_meta_store::insert_source", "Inserted contract source for path {key}");
         }
 
         // Commit the changes
@@ -246,10 +246,10 @@ impl ContractMetadataStoreOverlay {
         // Delete each source file associated with provided paths
         for path in source_paths.iter() {
             // Create key by pre-pending contract id to the source code path
-            let key = format!("{}/{}", contract_id, path);
+            let key = format!("{contract_id}/{path}");
             // Delete the source code
             lock.remove(SLED_CONTRACT_SOURCE_CODE_TREE, key.as_bytes())?;
-            debug!(target: "explorerd::contract_meta_store::delete_source", "Deleted contract source for path {}", key);
+            debug!(target: "explorerd::contract_meta_store::delete_source", "Deleted contract source for path {key}");
         }
 
         Ok(())
@@ -287,7 +287,7 @@ impl ContractMetadataStoreOverlay {
                 &serialized_metadata,
             )?;
             debug!(target: "explorerd::contract_meta_store::insert_metadata",
-                "Inserted contract metadata for contract_id {}: {metadata:?}", contract_id);
+                "Inserted contract metadata for contract_id {contract_id}: {metadata:?}");
         }
 
         // Commit the changes
@@ -363,14 +363,13 @@ mod tests {
             let actual_source = store.get_source_content(contract_id, source_path)?;
 
             // Verify that the source code content is the store
-            assert!(actual_source.is_some(), "No content found for path: {}", source_path);
+            assert!(actual_source.is_some(), "No content found for path: {source_path}");
 
             // Validate that the source content matches expected results
             assert_eq!(
                 actual_source.unwrap(),
                 expected_content.to_string(),
-                "Actual source does not match the expected results for path: {}",
-                source_path
+                "Actual source does not match the expected results for path: {source_path}"
             );
         }
 

+ 4 - 4
bin/explorer/explorerd/src/store/metrics.rs

@@ -511,7 +511,7 @@ impl MetricsStoreOverlay {
 
             // Insert serialized gas data
             lock.insert(SLED_TX_GAS_DATA_TREE, tx_hash.inner(), &serialized_gas_data)?;
-            debug!(target: "explorerd::metrics_store::insert_tx_gas_data", "Inserted gas data for transaction {}: {gas_data:?}", tx_hash);
+            debug!(target: "explorerd::metrics_store::insert_tx_gas_data", "Inserted gas data for transaction {tx_hash}: {gas_data:?}");
         }
 
         Ok(())
@@ -642,7 +642,7 @@ impl MetricsStoreOverlay {
 
             // Remove the corresponding entry from the gas metrics tree.
             lock.remove(SLED_GAS_METRICS_TREE, &key_to_revert.to_sled_key())?;
-            info!(target: "explorerd:metrics_store:revert_metrics", "Successfully reverted metrics with key: {}", key_to_revert);
+            info!(target: "explorerd:metrics_store:revert_metrics", "Successfully reverted metrics with key: {key_to_revert}");
 
             // Move to the previous valid timestamp by subtracting the defined time interval
             current_timestamp = current_timestamp.saturating_sub(GAS_METRICS_KEY_TIME_INTERVAL);
@@ -699,7 +699,7 @@ impl MetricsStoreOverlay {
 
             // Remove height being reverted
             lock.remove(SLED_GAS_METRICS_BY_HEIGHT_TREE, &cur_height_bytes)?;
-            info!(target: "explorerd:metrics_store:revert_by_height_metrics", "Successfully reverted metrics with height: {}", cur_height);
+            info!(target: "explorerd:metrics_store:revert_by_height_metrics", "Successfully reverted metrics with height: {cur_height}");
         }
 
         Ok(())
@@ -948,7 +948,7 @@ mod tests {
         // Process remaining heights, verifying that each stored metric matches expected results
         for (height, expected) in (1..).zip(test_data.iter().skip(1)) {
             let actual = store.get_by_height(&[height])?;
-            assert!(!actual.is_empty(), "No metrics found for height {}", height);
+            assert!(!actual.is_empty(), "No metrics found for height {height}");
             assert_eq!(expected, &actual[0]);
         }
 

+ 4 - 5
bin/explorer/explorerd/src/test_utils/mod.rs

@@ -123,8 +123,7 @@ pub async fn validate_invalid_rpc_parameter(
             assert_eq!(actual_error.error.code, expected_error_code);
         }
         _ => panic!(
-            "Expected a JSON error response for method: {}, but got something else",
-            method_name
+            "Expected a JSON error response for method: {method_name}, but got something else"
         ),
     }
 }
@@ -192,7 +191,7 @@ fn validate_invalid_rpc_hash_parameter(
             method,
             &[],
             ErrorCode::InvalidParams.code(),
-            &format!("Parameter '{}' at index 0 is missing", parameter_name),
+            &format!("Parameter '{parameter_name}' at index 0 is missing"),
         )
         .await;
 
@@ -202,7 +201,7 @@ fn validate_invalid_rpc_hash_parameter(
             method,
             &[JsonValue::Number(123.0)],
             ErrorCode::InvalidParams.code(),
-            &format!("Parameter '{}' is not a valid string", parameter_name),
+            &format!("Parameter '{parameter_name}' is not a valid string"),
         )
         .await;
 
@@ -212,7 +211,7 @@ fn validate_invalid_rpc_hash_parameter(
             method,
             &[JsonValue::String("0x0222".to_string())],
             ErrorCode::InvalidParams.code(),
-            &format!("{}: 0x0222", invalid_hash_value_message),
+            &format!("{invalid_hash_value_message}: 0x0222"),
         )
         .await;
     });