Skip to content

Commit

Permalink
clippy: miscellaneous simple fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
apoelstra committed Aug 8, 2024
1 parent fcb2c3d commit 8894215
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/confidential/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ mod tests {
ConfidentialTest {
key: Key::Bare(single_ct_key.clone()),
descriptor: crate::Descriptor::new_wpkh(single_spk_key).unwrap(),
descriptor_str: format!("ct(02dce16018bbbb8e36de7b394df5b5166e9adb7498be7d881a85a09aeecf76b623,elwpkh(03774eec7a3d550d18e9f89414152025b3b0ad6a342b19481f702d843cff06dfc4))#h5e0p6m9"),
descriptor_str: "ct(02dce16018bbbb8e36de7b394df5b5166e9adb7498be7d881a85a09aeecf76b623,elwpkh(03774eec7a3d550d18e9f89414152025b3b0ad6a342b19481f702d843cff06dfc4))#h5e0p6m9".to_string(),
conf_addr: "lq1qq0r6pegudzm0tzpszelc34qjln4fdxawgwmgnza63wwpzdy6jrm0grmqvvk2ce5ksnxcs9ecgtnryt7xg3406y5ccl0k2glns",
unconf_addr: "ex1qpasxxt9vv6tgfnvgzuuy9e3j9lryg6hawrval4",
},
Expand Down
7 changes: 0 additions & 7 deletions src/descriptor/csfs_cov/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,6 @@ mod tests {
.to_string(),
"ert1qamjdykcfzkcsvc9z32a6qcz3mwr85a3k7z7qf2uaufem2q3lsjxqj4y4fy"
);

println!(
"{}",
desc.address(&elements::AddressParams::ELEMENTS)
.unwrap()
.to_string()
);
}
#[test]
fn spend_tx() {
Expand Down
2 changes: 1 addition & 1 deletion src/descriptor/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ impl<K: InnerXKey> DescriptorXKey<K> {
Some((fingerprint, ref path)) => (
fingerprint,
path.into_iter()
.chain(self.derivation_path.into_iter())
.chain(&self.derivation_path)
.collect(),
),
None => (
Expand Down
1 change: 0 additions & 1 deletion src/descriptor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,6 @@ impl<Ext: Extension + ParseableExt> Descriptor<DescriptorPublicKey, Ext> {
///
/// For multipath descriptors it will return as many descriptors as there is
/// "parallel" paths. For regular descriptors it will just return itself.
#[allow(clippy::blocks_in_if_conditions)]
pub fn into_single_descriptors(self) -> Result<Vec<Self>, Error> {
// All single-path descriptors contained in this descriptor.
let mut descriptors = Vec::new();
Expand Down
2 changes: 1 addition & 1 deletion src/descriptor/pegin/dynafed_pegin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ where
C: secp256k1_zkp::Verification,
{
fn pk(&mut self, pk: &Pk) -> Result<bitcoin::PublicKey, ()> {
Ok(tweak_key(&pk.to_public_key(), self.1, &self.0[..]))
Ok(tweak_key(&pk.to_public_key(), self.1, self.0))
}

// We don't need to implement these methods as we are not using them in the policy.
Expand Down
2 changes: 1 addition & 1 deletion src/descriptor/tr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ mod tests {
assert!(!tr.for_each_key(|k| k.starts_with("acc")));
}

fn verify_from_str<'a>(desc_str: &str, internal_key: &str, scripts: &[TapLeafScript<'a, String, NoExt>]) {
fn verify_from_str(desc_str: &str, internal_key: &str, scripts: &[TapLeafScript<String, NoExt>]) {
let desc = Tr::<String, NoExt>::from_str(desc_str).unwrap();
assert_eq!(desc_str, &desc.to_string());
assert_eq!(internal_key, &desc.internal_key);
Expand Down
2 changes: 1 addition & 1 deletion src/miniscript/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ impl ScriptContext for BareCtx {
}
match ms.node {
Terminal::PkK(ref key) if key.is_x_only_key() => {
return Err(ScriptContextError::XOnlyKeysNotAllowed(
Err(ScriptContextError::XOnlyKeysNotAllowed(
key.to_string(),
Self::name_str(),
))
Expand Down
2 changes: 1 addition & 1 deletion src/miniscript/satisfy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

use std::collections::{BTreeMap, HashMap};
use std::sync::Arc;
use std::{cmp, i64, mem};
use std::{cmp, mem};

use bitcoin::hashes::hash160;
use bitcoin::secp256k1::XOnlyPublicKey;
Expand Down
4 changes: 1 addition & 3 deletions src/simplicity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ impl_from_str!(
// We cannot use our wrapper because we don't own the Policy (we have a reference)
// Implementing a wrapper of Cow<'a, Policy<Pk>> leads to lifetime issues
// when implementing ForEachKey, because for_each_key() has its own lifetime 'a
pub fn for_each_key<'a, Pk: MiniscriptKey, F: FnMut(&'a Pk) -> bool>(policy: &'a Policy<Pk>, mut pred: F) -> bool
where
Pk: 'a,
pub fn for_each_key<'a, Pk: MiniscriptKey + 'a, F: FnMut(&'a Pk) -> bool>(policy: &'a Policy<Pk>, mut pred: F) -> bool
{
let mut stack = vec![policy];

Expand Down

0 comments on commit 8894215

Please sign in to comment.