From: Vihiga Tyonum Date: Thu, 5 Jun 2025 13:42:55 +0000 (+0100) Subject: fix clippy warnings X-Git-Tag: v2.0.0~8^2~1 X-Git-Url: http://internal-gitweb-vhost/?a=commitdiff_plain;h=b289a61bcd97de4a8004d17d71bd29771af46d90;p=bdk-cli fix clippy warnings --- diff --git a/src/handlers.rs b/src/handlers.rs index 2d0c4bd..e3f2605 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -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) diff --git a/src/utils.rs b/src/utils.rs index c170cf8..c72fd80 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -140,7 +140,7 @@ pub(crate) enum BlockchainClient { }, #[cfg(feature = "cbf")] - KyotoClient { client: LightClient }, + KyotoClient { client: Box }, } #[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) -> 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) diff --git a/tests/integration.rs b/tests/integration.rs index fb35abe..31ffb69 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -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 { 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 { 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 { 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();