Skip to content

Commit

Permalink
fix: clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Crayon-Shin-chan-bitlightlabs committed Jan 15, 2025
1 parent b08fdfa commit ba99f12
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
4 changes: 2 additions & 2 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ impl Exec for RgbArgs {
WalletAll(&'w RgbWallet<Wallet<XpubDerivable, RgbDescr>>),
NoWallet,
}
impl<'w> AssignmentsFilter for Filter<'w> {
impl AssignmentsFilter for Filter<'_> {
fn should_include(
&self,
outpoint: impl Into<XOutpoint>,
Expand All @@ -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()
Expand Down
24 changes: 9 additions & 15 deletions src/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ pub struct WalletOutpointsFilter<'a, K, D: DescriptorRgb<K>, 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<K>, L2: Layer2> Copy for WalletOutpointsFilter<'a, K, D, L2> {}
impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> Clone for WalletOutpointsFilter<'a, K, D, L2> {
impl<K, D: DescriptorRgb<K>, L2: Layer2> Copy for WalletOutpointsFilter<'_, K, D, L2> {}
impl<K, D: DescriptorRgb<K>, L2: Layer2> Clone for WalletOutpointsFilter<'_, K, D, L2> {
fn clone(&self) -> Self { *self }
}

impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> AssignmentsFilter
for WalletOutpointsFilter<'a, K, D, L2>
{
impl<K, D: DescriptorRgb<K>, L2: Layer2> AssignmentsFilter for WalletOutpointsFilter<'_, K, D, L2> {
fn should_include(&self, output: impl Into<XOutpoint>, _: Option<XWitnessId>) -> bool {
match output.into().into_bp() {
Bp::Bitcoin(outpoint) => self.0.has_outpoint(outpoint),
Expand All @@ -49,14 +47,12 @@ pub struct WalletUnspentFilter<'a, K, D: DescriptorRgb<K>, 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<K>, L2: Layer2> Copy for WalletUnspentFilter<'a, K, D, L2> {}
impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> Clone for WalletUnspentFilter<'a, K, D, L2> {
impl<K, D: DescriptorRgb<K>, L2: Layer2> Copy for WalletUnspentFilter<'_, K, D, L2> {}
impl<K, D: DescriptorRgb<K>, L2: Layer2> Clone for WalletUnspentFilter<'_, K, D, L2> {
fn clone(&self) -> Self { *self }
}

impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> AssignmentsFilter
for WalletUnspentFilter<'a, K, D, L2>
{
impl<K, D: DescriptorRgb<K>, L2: Layer2> AssignmentsFilter for WalletUnspentFilter<'_, K, D, L2> {
fn should_include(&self, output: impl Into<XOutpoint>, _: Option<XWitnessId>) -> bool {
match output.into().into_bp() {
Bp::Bitcoin(outpoint) => self.0.is_unspent(outpoint),
Expand All @@ -69,14 +65,12 @@ pub struct WalletWitnessFilter<'a, K, D: DescriptorRgb<K>, 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<K>, L2: Layer2> Copy for WalletWitnessFilter<'a, K, D, L2> {}
impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> Clone for WalletWitnessFilter<'a, K, D, L2> {
impl<K, D: DescriptorRgb<K>, L2: Layer2> Copy for WalletWitnessFilter<'_, K, D, L2> {}
impl<K, D: DescriptorRgb<K>, L2: Layer2> Clone for WalletWitnessFilter<'_, K, D, L2> {
fn clone(&self) -> Self { *self }
}

impl<'a, K, D: DescriptorRgb<K>, L2: Layer2> AssignmentsFilter
for WalletWitnessFilter<'a, K, D, L2>
{
impl<K, D: DescriptorRgb<K>, L2: Layer2> AssignmentsFilter for WalletWitnessFilter<'_, K, D, L2> {
fn should_include(&self, _: impl Into<XOutpoint>, witness_id: Option<XWitnessId>) -> bool {
self.0
.history()
Expand Down
4 changes: 1 addition & 3 deletions src/pay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,13 @@ struct ContractOutpointsFilter<
}

impl<
'stock,
'wallet,
W: WalletProvider<K, L2> + ?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<K>
{
fn should_include(&self, output: impl Into<XOutpoint>, id: Option<XWitnessId>) -> bool {
Expand Down

0 comments on commit ba99f12

Please sign in to comment.