]> Untitled Git - bdk-cli/commitdiff
fix clippy warnings
authorVihiga Tyonum <withtvpeter@gmail.com>
Thu, 5 Jun 2025 13:42:55 +0000 (14:42 +0100)
committerVihiga Tyonum <withtvpeter@gmail.com>
Sat, 7 Jun 2025 15:56:17 +0000 (16:56 +0100)
src/handlers.rs
src/utils.rs
tests/integration.rs

index 2d0c4bde4f929966ea90e419814faf848a1eaee8..e3f260558ab98b57ecb7752312334402be74681a 100644 (file)
@@ -554,7 +554,7 @@ pub(crate) async fn handle_online_wallet_subcommand(
                         mut warning_subscriber,
                         update_subscriber: _,
                         node,
-                    } = client;
+                    } = *client;
 
                     let subscriber = tracing_subscriber::FmtSubscriber::new();
                     tracing::subscriber::set_global_default(subscriber)
index c170cf8ac64e159ac5d9f0e586a38dff44af1b47..c72fd80ea89f0c59f1002efaaedd80724f2f2c35 100644 (file)
@@ -140,7 +140,7 @@ pub(crate) enum BlockchainClient {
     },
 
     #[cfg(feature = "cbf")]
-    KyotoClient { client: LightClient },
+    KyotoClient { client: Box<LightClient> },
 }
 
 #[cfg(any(
@@ -206,7 +206,9 @@ pub(crate) fn new_blockchain_client(
                 .data_dir(&_datadir)
                 .build_with_wallet(_wallet, scan_type)?;
 
-            BlockchainClient::KyotoClient { client }
+            BlockchainClient::KyotoClient {
+                client: Box::new(client),
+            }
         }
     };
     Ok(client)
@@ -323,7 +325,7 @@ pub async fn trace_logger(
 
 // Handle Kyoto Client sync
 #[cfg(feature = "cbf")]
-pub async fn sync_kyoto_client(wallet: &mut Wallet, client: LightClient) -> Result<(), Error> {
+pub async fn sync_kyoto_client(wallet: &mut Wallet, client: Box<LightClient>) -> Result<(), Error> {
     let LightClient {
         requester,
         log_subscriber,
@@ -331,7 +333,7 @@ pub async fn sync_kyoto_client(wallet: &mut Wallet, client: LightClient) -> Resu
         warning_subscriber,
         mut update_subscriber,
         node,
-    } = client;
+    } = *client;
 
     let subscriber = tracing_subscriber::FmtSubscriber::new();
     tracing::subscriber::set_global_default(subscriber)
index fb35abea39ed2ebe00115a301d50c0ca640a80fd..31ffb69867c0e9dabe996eb3985109a8d2f9850c 100644 (file)
@@ -20,6 +20,7 @@ mod test {
     use std::process::Command;
 
     /// Testing errors for integration tests
+    #[allow(dead_code)]
     #[derive(Debug)]
     enum IntTestError {
         // IO error
@@ -38,11 +39,12 @@ mod test {
 
     // Helper function
     // Runs a system command with given args
+    #[allow(dead_code)]
     fn run_cmd_with_args(cmd: &str, args: &[&str]) -> Result<serde_json::Value, IntTestError> {
         let output = Command::new(cmd).args(args).output().unwrap();
         let mut value = output.stdout;
         let error = output.stderr;
-        if value.len() == 0 {
+        if value.is_empty() {
             return Err(IntTestError::CmdExec(String::from_utf8(error).unwrap()));
         }
         value.pop(); // remove `\n` at end
@@ -56,6 +58,7 @@ mod test {
 
     // Helper Function
     // Transforms a json value to string
+    #[allow(dead_code)]
     fn value_to_string(value: &Value) -> Result<String, IntTestError> {
         match value {
             Value::Bool(bool) => match bool {
@@ -72,6 +75,7 @@ mod test {
 
     // Helper Function
     // Extracts value from a given json object and key
+    #[allow(dead_code)]
     fn get_value(json: &Value, key: &str) -> Result<String, IntTestError> {
         let map = json
             .as_object()
@@ -86,6 +90,7 @@ mod test {
 
     /// The bdk-cli command struct
     /// Use it to perform all bdk-cli operations
+    #[allow(dead_code)]
     #[derive(Debug)]
     struct BdkCli {
         target: String,
@@ -108,10 +113,10 @@ mod test {
             let mut feat = "--features=".to_string();
             for item in features {
                 feat.push_str(item);
-                feat.push_str(",");
+                feat.push(',');
             }
             feat.pop(); // remove the last comma
-            let _build = Command::new("cargo").args(&["build", &feat]).output()?;
+            let _build = Command::new("cargo").args(["build", &feat]).output()?;
 
             let mut bdk_cli = Self {
                 target: "./target/debug/bdk-cli".to_string(),
@@ -159,7 +164,7 @@ mod test {
             wallet_args.push("-d");
             wallet_args.push(self.recv_desc.as_ref().unwrap());
             wallet_args.push("-c");
-            wallet_args.push(&self.chang_desc.as_ref().unwrap());
+            wallet_args.push(self.chang_desc.as_ref().unwrap());
 
             for arg in args {
                 wallet_args.push(arg);
@@ -195,6 +200,7 @@ mod test {
 
     // Run A Basic wallet operation test, with given feature
     #[cfg(test)]
+    #[allow(dead_code)]
     fn basic_wallet_ops(feature: &str) {
         // Create a temporary directory for testing env
         let mut test_dir = std::env::current_dir().unwrap();