From ba99f12d022d18877f40af4bdb88bf35c62f3f0b Mon Sep 17 00:00:00 2001 From: Crayon Shin-chan Date: Wed, 15 Jan 2025 21:54:41 +0800 Subject: [PATCH] fix: clippy lints --- cli/src/command.rs | 4 ++-- src/filters.rs | 24 +++++++++--------------- src/pay.rs | 4 +--- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/cli/src/command.rs b/cli/src/command.rs index f14b5c2..eaf75b2 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -574,7 +574,7 @@ impl Exec for RgbArgs { WalletAll(&'w RgbWallet>), NoWallet, } - impl<'w> AssignmentsFilter for Filter<'w> { + impl AssignmentsFilter for Filter<'_> { fn should_include( &self, outpoint: impl Into, @@ -589,7 +589,7 @@ impl Exec for RgbArgs { } } } - impl<'w> Filter<'w> { + impl Filter<'_> { fn comment(&self, outpoint: XOutpoint) -> &'static str { let outpoint = outpoint .into_bp() diff --git a/src/filters.rs b/src/filters.rs index 2cdbd44..03ade71 100644 --- a/src/filters.rs +++ b/src/filters.rs @@ -29,14 +29,12 @@ pub struct WalletOutpointsFilter<'a, K, D: DescriptorRgb, L2: Layer2>(pub &'a // We need manual derivation to ensure we can be copied and cloned even if descriptor is not // copyable/clonable. -impl<'a, K, D: DescriptorRgb, L2: Layer2> Copy for WalletOutpointsFilter<'a, K, D, L2> {} -impl<'a, K, D: DescriptorRgb, L2: Layer2> Clone for WalletOutpointsFilter<'a, K, D, L2> { +impl, L2: Layer2> Copy for WalletOutpointsFilter<'_, K, D, L2> {} +impl, L2: Layer2> Clone for WalletOutpointsFilter<'_, K, D, L2> { fn clone(&self) -> Self { *self } } -impl<'a, K, D: DescriptorRgb, L2: Layer2> AssignmentsFilter - for WalletOutpointsFilter<'a, K, D, L2> -{ +impl, L2: Layer2> AssignmentsFilter for WalletOutpointsFilter<'_, K, D, L2> { fn should_include(&self, output: impl Into, _: Option) -> bool { match output.into().into_bp() { Bp::Bitcoin(outpoint) => self.0.has_outpoint(outpoint), @@ -49,14 +47,12 @@ pub struct WalletUnspentFilter<'a, K, D: DescriptorRgb, L2: Layer2>(pub &'a W // We need manual derivation to ensure we can be copied and cloned even if descriptor is not // copyable/clonable. -impl<'a, K, D: DescriptorRgb, L2: Layer2> Copy for WalletUnspentFilter<'a, K, D, L2> {} -impl<'a, K, D: DescriptorRgb, L2: Layer2> Clone for WalletUnspentFilter<'a, K, D, L2> { +impl, L2: Layer2> Copy for WalletUnspentFilter<'_, K, D, L2> {} +impl, L2: Layer2> Clone for WalletUnspentFilter<'_, K, D, L2> { fn clone(&self) -> Self { *self } } -impl<'a, K, D: DescriptorRgb, L2: Layer2> AssignmentsFilter - for WalletUnspentFilter<'a, K, D, L2> -{ +impl, L2: Layer2> AssignmentsFilter for WalletUnspentFilter<'_, K, D, L2> { fn should_include(&self, output: impl Into, _: Option) -> bool { match output.into().into_bp() { Bp::Bitcoin(outpoint) => self.0.is_unspent(outpoint), @@ -69,14 +65,12 @@ pub struct WalletWitnessFilter<'a, K, D: DescriptorRgb, L2: Layer2>(pub &'a W // We need manual derivation to ensure we can be copied and cloned even if descriptor is not // copyable/clonable. -impl<'a, K, D: DescriptorRgb, L2: Layer2> Copy for WalletWitnessFilter<'a, K, D, L2> {} -impl<'a, K, D: DescriptorRgb, L2: Layer2> Clone for WalletWitnessFilter<'a, K, D, L2> { +impl, L2: Layer2> Copy for WalletWitnessFilter<'_, K, D, L2> {} +impl, L2: Layer2> Clone for WalletWitnessFilter<'_, K, D, L2> { fn clone(&self) -> Self { *self } } -impl<'a, K, D: DescriptorRgb, L2: Layer2> AssignmentsFilter - for WalletWitnessFilter<'a, K, D, L2> -{ +impl, L2: Layer2> AssignmentsFilter for WalletWitnessFilter<'_, K, D, L2> { fn should_include(&self, _: impl Into, witness_id: Option) -> bool { self.0 .history() diff --git a/src/pay.rs b/src/pay.rs index 43fc017..70f8ccc 100644 --- a/src/pay.rs +++ b/src/pay.rs @@ -80,15 +80,13 @@ struct ContractOutpointsFilter< } impl< - 'stock, - 'wallet, W: WalletProvider + ?Sized, K, S: StashProvider, H: StateProvider, P: IndexProvider, L2: Layer2, - > AssignmentsFilter for ContractOutpointsFilter<'stock, 'wallet, W, K, S, H, P, L2> + > AssignmentsFilter for ContractOutpointsFilter<'_, '_, W, K, S, H, P, L2> where W::Descr: DescriptorRgb { fn should_include(&self, output: impl Into, id: Option) -> bool {