Skip to content

Commit 7be26ae

Browse files
committed
clippy: fix reference-related syntax stuff
Mostly removing &s.
1 parent fc26508 commit 7be26ae

File tree

16 files changed

+34
-34
lines changed

16 files changed

+34
-34
lines changed

examples/psbt_sign_finalize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn main() {
1717
let secp256k1 = secp256k1::Secp256k1::new();
1818

1919
let s = "wsh(t:or_c(pk(027a3565454fe1b749bccaef22aff72843a9c3efefd7b16ac54537a0c23f0ec0de),v:thresh(1,pkh(032d672a1a91cc39d154d366cd231983661b0785c7f27bc338447565844f4a6813),a:pkh(03417129311ed34c242c012cd0a3e0b9bca0065f742d0dfb63c78083ea6a02d4d9),a:pkh(025a687659658baeabdfc415164528065be7bcaade19342241941e556557f01e28))))#7hut9ukn";
20-
let bridge_descriptor = Descriptor::from_str(&s).unwrap();
20+
let bridge_descriptor = Descriptor::from_str(s).unwrap();
2121
//let bridge_descriptor = Descriptor::<bitcoin::PublicKey>::from_str(&s).expect("parse descriptor string");
2222
assert!(bridge_descriptor.sanity_check().is_ok());
2323
println!(

examples/xpub_descriptors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn p2wsh<C: Verification>(secp: &Secp256k1<C>) -> Address {
4242

4343
let address = Descriptor::<DefiniteDescriptorKey>::from_str(&s)
4444
.unwrap()
45-
.derived_descriptor(&secp)
45+
.derived_descriptor(secp)
4646
.unwrap()
4747
.address(Network::Bitcoin)
4848
.unwrap();
@@ -65,7 +65,7 @@ fn p2sh_p2wsh<C: Verification>(secp: &Secp256k1<C>) -> Address {
6565

6666
let address = Descriptor::<DescriptorPublicKey>::from_str(&s)
6767
.unwrap()
68-
.derived_descriptor(&secp, 5)
68+
.derived_descriptor(secp, 5)
6969
.unwrap()
7070
.address(Network::Bitcoin)
7171
.unwrap();

src/descriptor/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ mod tests {
10731073
.push_opcode(opcodes::all::OP_DUP)
10741074
.push_opcode(opcodes::all::OP_HASH160)
10751075
.push_slice(
1076-
&hash160::Hash::from_str("84e9ed95a38613f0527ff685a9928abe2d4754d4",)
1076+
hash160::Hash::from_str("84e9ed95a38613f0527ff685a9928abe2d4754d4",)
10771077
.unwrap()
10781078
.to_byte_array()
10791079
)
@@ -1097,7 +1097,7 @@ mod tests {
10971097
script::Builder::new()
10981098
.push_opcode(opcodes::all::OP_PUSHBYTES_0)
10991099
.push_slice(
1100-
&hash160::Hash::from_str("84e9ed95a38613f0527ff685a9928abe2d4754d4",)
1100+
hash160::Hash::from_str("84e9ed95a38613f0527ff685a9928abe2d4754d4",)
11011101
.unwrap()
11021102
.to_byte_array()
11031103
)
@@ -1119,7 +1119,7 @@ mod tests {
11191119
script::Builder::new()
11201120
.push_opcode(opcodes::all::OP_HASH160)
11211121
.push_slice(
1122-
&hash160::Hash::from_str("f1c3b9a431134cb90a500ec06e0067cfa9b8bba7",)
1122+
hash160::Hash::from_str("f1c3b9a431134cb90a500ec06e0067cfa9b8bba7",)
11231123
.unwrap()
11241124
.to_byte_array()
11251125
)
@@ -1142,7 +1142,7 @@ mod tests {
11421142
script::Builder::new()
11431143
.push_opcode(opcodes::all::OP_HASH160)
11441144
.push_slice(
1145-
&hash160::Hash::from_str("aa5282151694d3f2f32ace7d00ad38f927a33ac8",)
1145+
hash160::Hash::from_str("aa5282151694d3f2f32ace7d00ad38f927a33ac8",)
11461146
.unwrap()
11471147
.to_byte_array()
11481148
)
@@ -1165,7 +1165,7 @@ mod tests {
11651165
script::Builder::new()
11661166
.push_opcode(opcodes::all::OP_PUSHBYTES_0)
11671167
.push_slice(
1168-
&sha256::Hash::from_str(
1168+
sha256::Hash::from_str(
11691169
"\
11701170
f9379edc8983152dc781747830075bd5\
11711171
3896e4b0ce5bff73777fd77d124ba085\
@@ -1192,7 +1192,7 @@ mod tests {
11921192
script::Builder::new()
11931193
.push_opcode(opcodes::all::OP_HASH160)
11941194
.push_slice(
1195-
&hash160::Hash::from_str("4bec5d7feeed99e1d0a23fe32a4afe126a7ff07e",)
1195+
hash160::Hash::from_str("4bec5d7feeed99e1d0a23fe32a4afe126a7ff07e",)
11961196
.unwrap()
11971197
.to_byte_array()
11981198
)
@@ -1297,7 +1297,7 @@ mod tests {
12971297
let redeem_script = script::Builder::new()
12981298
.push_opcode(opcodes::all::OP_PUSHBYTES_0)
12991299
.push_slice(
1300-
&hash160::Hash::from_str("d1b2a1faf62e73460af885c687dee3b7189cd8ab")
1300+
hash160::Hash::from_str("d1b2a1faf62e73460af885c687dee3b7189cd8ab")
13011301
.unwrap()
13021302
.to_byte_array(),
13031303
)

src/descriptor/sh.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,13 @@ impl<Pk: MiniscriptKey + ToPublicKey> Sh<Pk> {
348348
let witness_script = wsh.inner_script().to_v0_p2wsh();
349349
let push_bytes = <&PushBytes>::try_from(witness_script.as_bytes())
350350
.expect("Witness script is not too large");
351-
script::Builder::new().push_slice(&push_bytes).into_script()
351+
script::Builder::new().push_slice(push_bytes).into_script()
352352
}
353353
ShInner::Wpkh(ref wpkh) => {
354354
let redeem_script = wpkh.script_pubkey();
355355
let push_bytes: &PushBytes =
356356
<&PushBytes>::try_from(redeem_script.as_bytes()).expect("Script not too large");
357-
script::Builder::new().push_slice(&push_bytes).into_script()
357+
script::Builder::new().push_slice(push_bytes).into_script()
358358
}
359359
ShInner::SortedMulti(..) | ShInner::Ms(..) => ScriptBuf::new(),
360360
}

src/descriptor/tr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl<Pk: MiniscriptKey> TapTree<Pk> {
118118

119119
/// Iterates over all miniscripts in DFS walk order compatible with the
120120
/// PSBT requirements (BIP 371).
121-
pub fn iter(&self) -> TapTreeIter<Pk> {
121+
pub fn iter(&self) -> TapTreeIter<'_, Pk> {
122122
TapTreeIter {
123123
stack: vec![(0, self)],
124124
}
@@ -188,7 +188,7 @@ impl<Pk: MiniscriptKey> Tr<Pk> {
188188

189189
/// Iterate over all scripts in merkle tree. If there is no script path, the iterator
190190
/// yields [`None`]
191-
pub fn iter_scripts(&self) -> TapTreeIter<Pk> {
191+
pub fn iter_scripts(&self) -> TapTreeIter<'_, Pk> {
192192
match self.tree {
193193
Some(ref t) => t.iter(),
194194
None => TapTreeIter { stack: vec![] },
@@ -346,7 +346,7 @@ impl<Pk: MiniscriptKey + ToPublicKey> Tr<Pk> {
346346
let builder = bitcoin::blockdata::script::Builder::new();
347347
builder
348348
.push_opcode(opcodes::all::OP_PUSHNUM_1)
349-
.push_slice(&output_key.serialize())
349+
.push_slice(output_key.serialize())
350350
.into_script()
351351
}
352352

@@ -513,7 +513,7 @@ impl<Pk: MiniscriptKey> fmt::Display for Tr<Pk> {
513513
}
514514

515515
// Helper function to parse string into miniscript tree form
516-
fn parse_tr_tree(s: &str) -> Result<expression::Tree, Error> {
516+
fn parse_tr_tree(s: &str) -> Result<expression::Tree<'_>, Error> {
517517
for ch in s.bytes() {
518518
if !ch.is_ascii() {
519519
return Err(Error::Unprintable(ch));

src/interpreter/inner.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn script_from_stack_elem<Ctx: ScriptContext>(
4343
) -> Result<Miniscript<Ctx::Key, Ctx>, Error> {
4444
match *elem {
4545
stack::Element::Push(sl) => {
46-
Miniscript::parse_with_ext(&bitcoin::Script::from_bytes(sl), &ExtParams::allow_all())
46+
Miniscript::parse_with_ext(bitcoin::Script::from_bytes(sl), &ExtParams::allow_all())
4747
.map_err(Error::from)
4848
}
4949
stack::Element::Satisfied => {
@@ -453,9 +453,9 @@ mod tests {
453453
KeyTestData {
454454
pk_spk: bitcoin::ScriptBuf::new_p2pk(&key),
455455
pkh_spk: bitcoin::ScriptBuf::new_p2pkh(&pkhash),
456-
pk_sig: script::Builder::new().push_slice(&dummy_sig).into_script(),
456+
pk_sig: script::Builder::new().push_slice(dummy_sig).into_script(),
457457
pkh_sig: script::Builder::new()
458-
.push_slice(&dummy_sig)
458+
.push_slice(dummy_sig)
459459
.push_key(&key)
460460
.into_script(),
461461
pkh_sig_justkey: script::Builder::new().push_key(&key).into_script(),

src/miniscript/astelem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Terminal<Pk, Ctx> {
607607
Terminal::RawPkH(ref hash) => builder
608608
.push_opcode(opcodes::all::OP_DUP)
609609
.push_opcode(opcodes::all::OP_HASH160)
610-
.push_slice(&hash.to_byte_array())
610+
.push_slice(hash.to_byte_array())
611611
.push_opcode(opcodes::all::OP_EQUALVERIFY),
612612
Terminal::After(t) => builder
613613
.push_int(absolute::LockTime::from(t).to_consensus_u32() as i64)

src/miniscript/iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ 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> {
21+
pub fn iter(&self) -> Iter<'_, Pk, Ctx> {
2222
Iter::new(self)
2323
}
2424

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

src/miniscript/lex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<'s> TokenIter<'s> {
7878
}
7979

8080
/// Look at the top at Iterator
81-
pub fn peek(&self) -> Option<&'s Token> {
81+
pub fn peek(&self) -> Option<&'s Token<'_>> {
8282
self.0.last()
8383
}
8484

src/miniscript/satisfy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ where
221221
}
222222
}
223223

224-
impl<'a, Pk: MiniscriptKey + ToPublicKey, S: Satisfier<Pk>> Satisfier<Pk> for &'a S {
224+
impl<Pk: MiniscriptKey + ToPublicKey, S: Satisfier<Pk>> Satisfier<Pk> for &'_ S {
225225
fn lookup_ecdsa_sig(&self, p: &Pk) -> Option<bitcoin::ecdsa::Signature> {
226226
(**self).lookup_ecdsa_sig(p)
227227
}
@@ -291,7 +291,7 @@ impl<'a, Pk: MiniscriptKey + ToPublicKey, S: Satisfier<Pk>> Satisfier<Pk> for &'
291291
}
292292
}
293293

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

0 commit comments

Comments
 (0)