From 38581194c3a8fd451f92b2ae38e928ac47afd60c Mon Sep 17 00:00:00 2001 From: qima Date: Fri, 14 Jun 2024 16:43:12 +0800 Subject: [PATCH] chore: resolve clippy complaints --- sn_transfers/src/cashnotes/spend_reason.rs | 2 +- sn_transfers/src/wallet/hot_wallet.rs | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/sn_transfers/src/cashnotes/spend_reason.rs b/sn_transfers/src/cashnotes/spend_reason.rs index ded813c7a2..157ee2d3bc 100644 --- a/sn_transfers/src/cashnotes/spend_reason.rs +++ b/sn_transfers/src/cashnotes/spend_reason.rs @@ -61,7 +61,7 @@ impl SpendReason { } } -const MAX_CIPHER_SIZE: usize = std::u8::MAX as usize; +const MAX_CIPHER_SIZE: usize = u8::MAX as usize; const DERIVATION_INDEX_SIZE: usize = 32; const HASH_SIZE: usize = 32; const CHECK_SUM_SIZE: usize = 8; diff --git a/sn_transfers/src/wallet/hot_wallet.rs b/sn_transfers/src/wallet/hot_wallet.rs index c5f2ba47c9..3706c9a49b 100644 --- a/sn_transfers/src/wallet/hot_wallet.rs +++ b/sn_transfers/src/wallet/hot_wallet.rs @@ -151,10 +151,8 @@ impl HotWallet { std::fs::create_dir_all(&wallet_dir)?; // Create the new wallet for this key store_new_keypair(&wallet_dir, &key)?; - let unconfirmed_spend_requests = match get_unconfirmed_spend_requests(&wallet_dir)? { - Some(unconfirmed_spend_requests) => unconfirmed_spend_requests, - None => Default::default(), - }; + let unconfirmed_spend_requests = + (get_unconfirmed_spend_requests(&wallet_dir)?).unwrap_or_default(); let watchonly_wallet = WatchOnlyWallet::load_from(&wallet_dir, key.main_pubkey())?; Ok(Self { @@ -667,10 +665,8 @@ impl HotWallet { } } }; - let unconfirmed_spend_requests = match get_unconfirmed_spend_requests(wallet_dir)? { - Some(unconfirmed_spend_requests) => unconfirmed_spend_requests, - None => Default::default(), - }; + let unconfirmed_spend_requests = + (get_unconfirmed_spend_requests(wallet_dir)?).unwrap_or_default(); let watchonly_wallet = WatchOnlyWallet::load_from(wallet_dir, key.main_pubkey())?; Ok(Self {