From e10366410303bc1aff7308e6a944dcb01e16e23a Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Wed, 18 Jan 2023 11:02:17 +0530 Subject: [PATCH] Derive Eq on enums and struts where possible --- src/commands.rs | 18 +++++++++--------- src/handlers.rs | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 6bc5999..6b64c87 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -144,7 +144,7 @@ pub enum CliSubCommand { } /// Backend Node operation subcommands. -#[derive(Debug, Subcommand, Clone, PartialEq)] +#[derive(Debug, Subcommand, Clone, PartialEq, Eq)] #[clap(rename_all = "lower")] #[cfg(any(feature = "regtest-node"))] pub enum NodeSubCommand { @@ -179,7 +179,7 @@ pub enum WalletSubCommand { } /// Config options wallet operations can take. -#[derive(Debug, Parser, Clone, PartialEq)] +#[derive(Debug, Parser, Clone, PartialEq, Eq)] pub struct WalletOpts { /// Selects the wallet to use. #[clap(name = "WALLET_NAME", short = 'w', long = "wallet")] @@ -212,7 +212,7 @@ pub struct WalletOpts { /// Options to configure a SOCKS5 proxy for a blockchain client connection. #[cfg(any(feature = "compact_filters", feature = "electrum", feature = "esplora"))] -#[derive(Debug, Args, Clone, PartialEq)] +#[derive(Debug, Args, Clone, PartialEq, Eq)] pub struct ProxyOpts { /// Sets the SOCKS5 proxy for a blockchain client. #[clap(name = "PROXY_ADDRS:PORT", long = "proxy", short = 'p')] @@ -234,7 +234,7 @@ pub struct ProxyOpts { /// Options to configure a BIP157 Compact Filter backend. #[cfg(feature = "compact_filters")] -#[derive(Debug, Args, Clone, PartialEq)] +#[derive(Debug, Args, Clone, PartialEq, Eq)] pub struct CompactFilterOpts { /// Sets the full node network address. #[clap( @@ -261,7 +261,7 @@ pub struct CompactFilterOpts { /// Options to configure a bitcoin core rpc backend. #[cfg(feature = "rpc")] -#[derive(Debug, Args, Clone, PartialEq)] +#[derive(Debug, Args, Clone, PartialEq, Eq)] pub struct RpcOpts { /// Sets the full node address for rpc connection. #[clap( @@ -298,7 +298,7 @@ pub struct RpcOpts { /// Options to configure electrum backend. #[cfg(feature = "electrum")] -#[derive(Debug, Args, Clone, PartialEq)] +#[derive(Debug, Args, Clone, PartialEq, Eq)] pub struct ElectrumOpts { /// Sets the SOCKS5 proxy timeout for the Electrum client. #[clap(name = "PROXY_TIMEOUT", short = 't', long = "timeout")] @@ -324,7 +324,7 @@ pub struct ElectrumOpts { /// Options to configure Esplora backend. #[cfg(feature = "esplora")] -#[derive(Debug, Args, Clone, PartialEq)] +#[derive(Debug, Args, Clone, PartialEq, Eq)] pub struct EsploraOpts { /// Use the esplora server if given as parameter. #[clap( @@ -477,7 +477,7 @@ pub enum OfflineWalletSubCommand { } /// Wallet subcommands that needs a blockchain backend. -#[derive(Debug, Subcommand, Clone, PartialEq)] +#[derive(Debug, Subcommand, Clone, PartialEq, Eq)] #[clap(rename_all = "snake")] #[cfg(any( feature = "electrum", @@ -530,7 +530,7 @@ pub enum OnlineWalletSubCommand { } /// Subcommands for Key operations. -#[derive(Debug, Subcommand, Clone, PartialEq)] +#[derive(Debug, Subcommand, Clone, PartialEq, Eq)] pub enum KeySubCommand { /// Generates new random seed mnemonic phrase and corresponding master extended key. Generate { diff --git a/src/handlers.rs b/src/handlers.rs index ca35231..36c31a2 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -747,18 +747,18 @@ pub(crate) fn handle_command(cli_opts: CliOpts) -> Result { result.map_err(|e| e.into()) } +#[cfg(any( + feature = "electrum", + feature = "esplora", + feature = "compact_filters", + feature = "rpc" +))] #[cfg(test)] mod test { use super::*; use bdk::bitcoin::psbt::PartiallySignedTransaction; use std::str::FromStr; - #[cfg(any( - feature = "electrum", - feature = "esplora", - feature = "compact_filters", - feature = "rpc" - ))] #[test] fn test_psbt_is_final() { let unsigned_psbt = PartiallySignedTransaction::from_str("cHNidP8BAIkBAAAAASWJHzxzyVORV/C3lAynKHVVL7+Rw7/Jj8U9fuvD24olAAAAAAD+////AiBOAAAAAAAAIgAgLzY9yE4jzTFJnHtTjkc+rFAtJ9NB7ENFQ1xLYoKsI1cfqgKVAAAAACIAIFsbWgDeLGU8EA+RGwBDIbcv4gaGG0tbEIhDvwXXa/E7LwEAAAABALUCAAAAAAEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////BALLAAD/////AgD5ApUAAAAAIgAgWxtaAN4sZTwQD5EbAEMhty/iBoYbS1sQiEO/Bddr8TsAAAAAAAAAACZqJKohqe3i9hw/cdHe/T+pmd+jaVN1XGkGiXmZYrSL69g2l06M+QEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQErAPkClQAAAAAiACBbG1oA3ixlPBAPkRsAQyG3L+IGhhtLWxCIQ78F12vxOwEFR1IhA/JV2U/0pXW+iP49QcsYilEvkZEd4phmDM8nV8wC+MeDIQLKhV/gEZYmlsQXnsL5/Uqv5Y8O31tmWW1LQqIBkiqzCVKuIgYCyoVf4BGWJpbEF57C+f1Kr+WPDt9bZlltS0KiAZIqswkEboH3lCIGA/JV2U/0pXW+iP49QcsYilEvkZEd4phmDM8nV8wC+MeDBDS6ZSEAACICAsqFX+ARliaWxBeewvn9Sq/ljw7fW2ZZbUtCogGSKrMJBG6B95QiAgPyVdlP9KV1voj+PUHLGIpRL5GRHeKYZgzPJ1fMAvjHgwQ0umUhAA==").unwrap(); -- 2.49.0