Skip to content

Commit 4f7782f

Browse files
committed
clippy: minor things
Also fixes a bunch of unused imports that are detected by the latest rustc nightly. (One is a wildcard import that actually imports nothing; the other are prelude things in a private prelude module.)
1 parent a61f71a commit 4f7782f

File tree

6 files changed

+15
-17
lines changed

6 files changed

+15
-17
lines changed

src/descriptor/key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ impl DescriptorPublicKey {
589589
};
590590
xpub.derivation_paths
591591
.paths()
592-
.into_iter()
592+
.iter()
593593
.map(|p| origin_path.extend(p))
594594
.collect()
595595
}

src/descriptor/tr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ where
737737
wit.push(Placeholder::TapScript(leaf_script.0));
738738
wit.push(Placeholder::TapControlBlock(control_block));
739739

740-
let wit_size = witness_size(&wit);
740+
let wit_size = witness_size(wit);
741741
if min_wit_len.is_some() && Some(wit_size) > min_wit_len {
742742
continue;
743743
} else {

src/iter/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl<'a, Pk: MiniscriptKey> TreeLike for &'a policy::Concrete<Pk> {
8282
}
8383
}
8484

85-
impl<'a, Pk: MiniscriptKey> TreeLike for Arc<policy::Concrete<Pk>> {
85+
impl<Pk: MiniscriptKey> TreeLike for Arc<policy::Concrete<Pk>> {
8686
fn as_node(&self) -> Tree<Self> {
8787
use policy::Concrete::*;
8888
match self.as_ref() {

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ mod macros;
116116
mod pub_macros;
117117

118118
use internals::hex::exts::DisplayHex;
119-
pub use pub_macros::*;
120119

121120
pub mod descriptor;
122121
pub mod expression;
@@ -812,6 +811,8 @@ mod tests {
812811
}
813812
}
814813

814+
815+
#[allow(unused_imports)] // this is an internal prelude module; not all imports are used with every feature combination
815816
mod prelude {
816817
// Mutex implementation from LDK
817818
// https://github.com/lightningdevkit/rust-lightning/blob/9bdce47f0e0516e37c89c09f1975dfc06b5870b1/lightning-invoice/src/sync.rs

src/plan.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,13 @@ impl Plan {
255255
// scriptSig len (1) + OP_0 (1) + OP_PUSHBYTES_32 (1) + <script hash> (32)
256256
(_, DescriptorType::ShWsh) | (_, DescriptorType::ShWshSortedMulti) => 1 + 1 + 1 + 32,
257257
// Native Segwit v0 (scriptSig len (1))
258-
__ => 1,
258+
_ => 1,
259259
}
260260
}
261261

262262
/// The size in bytes of the witness that satisfies this plan
263263
pub fn witness_size(&self) -> usize {
264-
if let Some(_) = self.descriptor.desc_type().segwit_version() {
264+
if self.descriptor.desc_type().segwit_version().is_some() {
265265
witness_size(self.template.as_ref())
266266
} else {
267267
0 // should be 1 if there's at least one segwit input in the tx, but that's out of
@@ -397,17 +397,14 @@ impl Plan {
397397
}
398398
} else {
399399
for item in &self.template {
400-
match item {
401-
Placeholder::EcdsaSigPk(pk) => {
402-
let public_key = pk.to_public_key().inner;
403-
let master_fingerprint = pk.master_fingerprint();
404-
for derivation_path in pk.full_derivation_paths() {
405-
input
406-
.bip32_derivation
407-
.insert(public_key, (master_fingerprint, derivation_path));
408-
}
400+
if let Placeholder::EcdsaSigPk(pk) = item {
401+
let public_key = pk.to_public_key().inner;
402+
let master_fingerprint = pk.master_fingerprint();
403+
for derivation_path in pk.full_derivation_paths() {
404+
input
405+
.bip32_derivation
406+
.insert(public_key, (master_fingerprint, derivation_path));
409407
}
410-
_ => {}
411408
}
412409
}
413410

src/psbt/finalizer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ pub(super) fn finalize_input<C: secp256k1::Verification>(
428428
// Now mutate the psbt input. Note that we cannot error after this point.
429429
// If the input is mutated, it means that the finalization succeeded.
430430
{
431-
let original = mem::replace(&mut psbt.inputs[index], Default::default());
431+
let original = mem::take(&mut psbt.inputs[index]);
432432
let input = &mut psbt.inputs[index];
433433
input.non_witness_utxo = original.non_witness_utxo;
434434
input.witness_utxo = original.witness_utxo;

0 commit comments

Comments
 (0)