Skip to content

Commit 9efc345

Browse files
committed
clippy: lifetime syntax stuff
1 parent 01bfd22 commit 9efc345

File tree

9 files changed

+13
-13
lines changed

9 files changed

+13
-13
lines changed

src/descriptor/tr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<Pk: MiniscriptKey> TapTree<Pk> {
129129

130130
/// Iterates over all miniscripts in DFS walk order compatible with the
131131
/// PSBT requirements (BIP 371).
132-
pub fn iter(&self) -> TapTreeIter<Pk> { TapTreeIter { stack: vec![(0, self)] } }
132+
pub fn iter(&self) -> TapTreeIter<'_, Pk> { TapTreeIter { stack: vec![(0, self)] } }
133133

134134
// Helper function to translate keys
135135
fn translate_helper<T, Q, E>(&self, t: &mut T) -> Result<TapTree<Q>, TranslateErr<E>>
@@ -196,7 +196,7 @@ impl<Pk: MiniscriptKey> Tr<Pk> {
196196

197197
/// Iterate over all scripts in merkle tree. If there is no script path, the iterator
198198
/// yields [`None`]
199-
pub fn iter_scripts(&self) -> TapTreeIter<Pk> {
199+
pub fn iter_scripts(&self) -> TapTreeIter<'_, Pk> {
200200
match self.tree {
201201
Some(ref t) => t.iter(),
202202
None => TapTreeIter { stack: vec![] },
@@ -565,7 +565,7 @@ impl<Pk: MiniscriptKey> fmt::Display for Tr<Pk> {
565565
}
566566

567567
// Helper function to parse string into miniscript tree form
568-
fn parse_tr_tree(s: &str) -> Result<expression::Tree, Error> {
568+
fn parse_tr_tree(s: &str) -> Result<expression::Tree<'_>, Error> {
569569
expression::check_valid_chars(s)?;
570570

571571
if s.len() > 3 && &s[..3] == "tr(" && s.as_bytes()[s.len() - 1] == b')' {

src/iter/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub use tree::{
1717
use crate::sync::Arc;
1818
use crate::{Miniscript, MiniscriptKey, ScriptContext, Terminal};
1919

20-
impl<'a, Pk: MiniscriptKey, Ctx: ScriptContext> TreeLike for &'a Miniscript<Pk, Ctx> {
20+
impl<Pk: MiniscriptKey, Ctx: ScriptContext> TreeLike for &'_ Miniscript<Pk, Ctx> {
2121
fn as_node(&self) -> Tree<Self> {
2222
use Terminal::*;
2323
match self.node {

src/miniscript/iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {
1818
/// Creates a new [Iter] iterator that will iterate over all [Miniscript] items within
1919
/// AST by traversing its branches. For the specific algorithm please see
2020
/// [Iter::next] function.
21-
pub fn iter(&self) -> Iter<Pk, Ctx> { Iter::new(self) }
21+
pub fn iter(&self) -> Iter<'_, Pk, Ctx> { Iter::new(self) }
2222

2323
/// Creates a new [PkIter] iterator that will iterate over all plain public keys (and not
2424
/// key hash values) present in [Miniscript] items within AST by traversing all its branches.
2525
/// For the specific algorithm please see [PkIter::next] function.
26-
pub fn iter_pk(&self) -> PkIter<Pk, Ctx> { PkIter::new(self) }
26+
pub fn iter_pk(&self) -> PkIter<'_, Pk, Ctx> { PkIter::new(self) }
2727

2828
/// Enumerates all child nodes of the current AST node (`self`) and returns a `Vec` referencing
2929
/// them.

src/miniscript/lex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'s> TokenIter<'s> {
7575
pub fn new(v: Vec<Token<'s>>) -> TokenIter<'s> { TokenIter(v) }
7676

7777
/// Look at the top at Iterator
78-
pub fn peek(&self) -> Option<&'s Token> { self.0.last() }
78+
pub fn peek(&self) -> Option<&'s Token<'_>> { self.0.last() }
7979

8080
/// Push a value to the iterator
8181
/// This will be first value consumed by popun_

src/miniscript/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {
551551
///
552552
/// Returns the fragment name (right of the `:`) and a list of wrappers
553553
/// (left of the `:`).
554-
fn split_expression_name(name: &str) -> Result<(&str, Cow<str>), Error> {
554+
fn split_expression_name(name: &str) -> Result<(&str, Cow<'_, str>), Error> {
555555
let mut aliased_wrap;
556556
let frag_name;
557557
let frag_wrap;

src/miniscript/satisfy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ impl_satisfier_for_map_hash_tapleafhash_to_key_taproot_sig! {
259259
impl Satisfier<Pk> for HashMap<(hash160::Hash, TapLeafHash), (Pk, bitcoin::taproot::Signature)>
260260
}
261261

262-
impl<'a, Pk: MiniscriptKey + ToPublicKey, S: Satisfier<Pk>> Satisfier<Pk> for &'a S {
262+
impl<Pk: MiniscriptKey + ToPublicKey, S: Satisfier<Pk>> Satisfier<Pk> for &'_ S {
263263
fn lookup_ecdsa_sig(&self, p: &Pk) -> Option<bitcoin::ecdsa::Signature> {
264264
(**self).lookup_ecdsa_sig(p)
265265
}
@@ -319,7 +319,7 @@ impl<'a, Pk: MiniscriptKey + ToPublicKey, S: Satisfier<Pk>> Satisfier<Pk> for &'
319319
fn check_after(&self, n: absolute::LockTime) -> bool { (**self).check_after(n) }
320320
}
321321

322-
impl<'a, Pk: MiniscriptKey + ToPublicKey, S: Satisfier<Pk>> Satisfier<Pk> for &'a mut S {
322+
impl<Pk: MiniscriptKey + ToPublicKey, S: Satisfier<Pk>> Satisfier<Pk> for &'_ mut S {
323323
fn lookup_ecdsa_sig(&self, p: &Pk) -> Option<bitcoin::ecdsa::Signature> {
324324
(**self).lookup_ecdsa_sig(p)
325325
}

src/policy/concrete.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ fn generate_combination<Pk: MiniscriptKey>(
10441044
ret
10451045
}
10461046

1047-
impl<'a, Pk: MiniscriptKey> TreeLike for &'a Policy<Pk> {
1047+
impl<Pk: MiniscriptKey> TreeLike for &'_ Policy<Pk> {
10481048
fn as_node(&self) -> Tree<Self> {
10491049
use Policy::*;
10501050

src/policy/semantic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
619619
}
620620
}
621621

622-
impl<'a, Pk: MiniscriptKey> TreeLike for &'a Policy<Pk> {
622+
impl<Pk: MiniscriptKey> TreeLike for &'_ Policy<Pk> {
623623
fn as_node(&self) -> Tree<Self> {
624624
use Policy::*;
625625

src/primitives/threshold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl<T, const MAX: usize> Threshold<T, MAX> {
211211
pub fn into_data(self) -> Vec<T> { self.inner }
212212

213213
/// Passthrough to an iterator on the underlying vector.
214-
pub fn iter(&self) -> core::slice::Iter<T> { self.inner.iter() }
214+
pub fn iter(&self) -> core::slice::Iter<'_, T> { self.inner.iter() }
215215
}
216216

217217
impl<T> Threshold<T, 0> {

0 commit comments

Comments
 (0)