Skip to content

Commit 8894215

Browse files
committed
clippy: miscellaneous simple fixes
1 parent fcb2c3d commit 8894215

File tree

9 files changed

+7
-17
lines changed

9 files changed

+7
-17
lines changed

src/confidential/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ mod tests {
408408
ConfidentialTest {
409409
key: Key::Bare(single_ct_key.clone()),
410410
descriptor: crate::Descriptor::new_wpkh(single_spk_key).unwrap(),
411-
descriptor_str: format!("ct(02dce16018bbbb8e36de7b394df5b5166e9adb7498be7d881a85a09aeecf76b623,elwpkh(03774eec7a3d550d18e9f89414152025b3b0ad6a342b19481f702d843cff06dfc4))#h5e0p6m9"),
411+
descriptor_str: "ct(02dce16018bbbb8e36de7b394df5b5166e9adb7498be7d881a85a09aeecf76b623,elwpkh(03774eec7a3d550d18e9f89414152025b3b0ad6a342b19481f702d843cff06dfc4))#h5e0p6m9".to_string(),
412412
conf_addr: "lq1qq0r6pegudzm0tzpszelc34qjln4fdxawgwmgnza63wwpzdy6jrm0grmqvvk2ce5ksnxcs9ecgtnryt7xg3406y5ccl0k2glns",
413413
unconf_addr: "ex1qpasxxt9vv6tgfnvgzuuy9e3j9lryg6hawrval4",
414414
},

src/descriptor/csfs_cov/mod.rs

-7
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,6 @@ mod tests {
373373
.to_string(),
374374
"ert1qamjdykcfzkcsvc9z32a6qcz3mwr85a3k7z7qf2uaufem2q3lsjxqj4y4fy"
375375
);
376-
377-
println!(
378-
"{}",
379-
desc.address(&elements::AddressParams::ELEMENTS)
380-
.unwrap()
381-
.to_string()
382-
);
383376
}
384377
#[test]
385378
fn spend_tx() {

src/descriptor/key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ impl<K: InnerXKey> DescriptorXKey<K> {
947947
Some((fingerprint, ref path)) => (
948948
fingerprint,
949949
path.into_iter()
950-
.chain(self.derivation_path.into_iter())
950+
.chain(&self.derivation_path)
951951
.collect(),
952952
),
953953
None => (

src/descriptor/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,6 @@ impl<Ext: Extension + ParseableExt> Descriptor<DescriptorPublicKey, Ext> {
10161016
///
10171017
/// For multipath descriptors it will return as many descriptors as there is
10181018
/// "parallel" paths. For regular descriptors it will just return itself.
1019-
#[allow(clippy::blocks_in_if_conditions)]
10201019
pub fn into_single_descriptors(self) -> Result<Vec<Self>, Error> {
10211020
// All single-path descriptors contained in this descriptor.
10221021
let mut descriptors = Vec::new();

src/descriptor/pegin/dynafed_pegin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ where
297297
C: secp256k1_zkp::Verification,
298298
{
299299
fn pk(&mut self, pk: &Pk) -> Result<bitcoin::PublicKey, ()> {
300-
Ok(tweak_key(&pk.to_public_key(), self.1, &self.0[..]))
300+
Ok(tweak_key(&pk.to_public_key(), self.1, self.0))
301301
}
302302

303303
// We don't need to implement these methods as we are not using them in the policy.

src/descriptor/tr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ mod tests {
973973
assert!(!tr.for_each_key(|k| k.starts_with("acc")));
974974
}
975975

976-
fn verify_from_str<'a>(desc_str: &str, internal_key: &str, scripts: &[TapLeafScript<'a, String, NoExt>]) {
976+
fn verify_from_str(desc_str: &str, internal_key: &str, scripts: &[TapLeafScript<String, NoExt>]) {
977977
let desc = Tr::<String, NoExt>::from_str(desc_str).unwrap();
978978
assert_eq!(desc_str, &desc.to_string());
979979
assert_eq!(internal_key, &desc.internal_key);

src/miniscript/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ impl ScriptContext for BareCtx {
757757
}
758758
match ms.node {
759759
Terminal::PkK(ref key) if key.is_x_only_key() => {
760-
return Err(ScriptContextError::XOnlyKeysNotAllowed(
760+
Err(ScriptContextError::XOnlyKeysNotAllowed(
761761
key.to_string(),
762762
Self::name_str(),
763763
))

src/miniscript/satisfy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
use std::collections::{BTreeMap, HashMap};
1111
use std::sync::Arc;
12-
use std::{cmp, i64, mem};
12+
use std::{cmp, mem};
1313

1414
use bitcoin::hashes::hash160;
1515
use bitcoin::secp256k1::XOnlyPublicKey;

src/simplicity.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ impl_from_str!(
9898
// We cannot use our wrapper because we don't own the Policy (we have a reference)
9999
// Implementing a wrapper of Cow<'a, Policy<Pk>> leads to lifetime issues
100100
// when implementing ForEachKey, because for_each_key() has its own lifetime 'a
101-
pub fn for_each_key<'a, Pk: MiniscriptKey, F: FnMut(&'a Pk) -> bool>(policy: &'a Policy<Pk>, mut pred: F) -> bool
102-
where
103-
Pk: 'a,
101+
pub fn for_each_key<'a, Pk: MiniscriptKey + 'a, F: FnMut(&'a Pk) -> bool>(policy: &'a Policy<Pk>, mut pred: F) -> bool
104102
{
105103
let mut stack = vec![policy];
106104

0 commit comments

Comments
 (0)