Skip to content

Commit f0820ce

Browse files
committed
Remove redundant explicit references
Clippy emits: warning: this expression creates a reference which is immediately dereferenced by the compiler Remove redundant explicit references.
1 parent 64c6e51 commit f0820ce

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

src/descriptor/key.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl fmt::Display for DescriptorSecretKey {
138138
DescriptorSecretKey::MultiXPrv(ref xprv) => {
139139
maybe_fmt_master_id(f, &xprv.origin)?;
140140
xprv.xkey.fmt(f)?;
141-
fmt_derivation_paths(f, &xprv.derivation_paths.paths())?;
141+
fmt_derivation_paths(f, xprv.derivation_paths.paths())?;
142142
match xprv.wildcard {
143143
Wildcard::None => {}
144144
Wildcard::Unhardened => write!(f, "/*")?,
@@ -302,7 +302,7 @@ impl fmt::Display for DescriptorPublicKey {
302302
DescriptorPublicKey::MultiXPub(ref xpub) => {
303303
maybe_fmt_master_id(f, &xpub.origin)?;
304304
xpub.xkey.fmt(f)?;
305-
fmt_derivation_paths(f, &xpub.derivation_paths.paths())?;
305+
fmt_derivation_paths(f, xpub.derivation_paths.paths())?;
306306
match xpub.wildcard {
307307
Wildcard::None => {}
308308
Wildcard::Unhardened => write!(f, "/*")?,

src/descriptor/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ impl Descriptor<DescriptorPublicKey> {
584584
secp: &secp256k1::Secp256k1<C>,
585585
index: u32,
586586
) -> Result<Descriptor<bitcoin::PublicKey>, ConversionError> {
587-
self.at_derivation_index(index)?.derived_descriptor(&secp)
587+
self.at_derivation_index(index)?.derived_descriptor(secp)
588588
}
589589

590590
/// Parse a descriptor that may contain secret keys
@@ -865,7 +865,7 @@ impl Descriptor<DefiniteDescriptorKey> {
865865
&mut self,
866866
pk: &DefiniteDescriptorKey,
867867
) -> Result<bitcoin::PublicKey, ConversionError> {
868-
pk.derive_public_key(&self.0)
868+
pk.derive_public_key(self.0)
869869
}
870870

871871
translate_hash_clone!(DefiniteDescriptorKey, bitcoin::PublicKey, ConversionError);
@@ -967,7 +967,7 @@ mod tests {
967967
const TEST_PK: &str = "pk(020000000000000000000000000000000000000000000000000000000000000002)";
968968

969969
fn roundtrip_descriptor(s: &str) {
970-
let desc = Descriptor::<DummyKey>::from_str(&s).unwrap();
970+
let desc = Descriptor::<DummyKey>::from_str(s).unwrap();
971971
let output = desc.to_string();
972972
let normalize_aliases = s.replace("c:pk_k(", "pk(").replace("c:pk_h(", "pkh(");
973973
assert_eq!(
@@ -1756,8 +1756,8 @@ mod tests {
17561756
"sh(multi(2,[00000000/111'/222]xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0))##tjq09x4t"
17571757
);
17581758

1759-
Descriptor::parse_descriptor(&secp, "sh(multi(2,[00000000/111'/222]xprvA1RpRA33e1JQ7ifknakTFpgNXPmW2YvmhqLQYMmrj4xJXXWYpDPS3xz7iAxn8L39njGVyuoseXzU6rcxFLJ8HFsTjSyQbLYnMpCqE2VbFWc,xprv9uPDJpEQgRQfDcW7BkF7eTya6RPxXeJCqCJGHuCJ4GiRVLzkTXBAJMu2qaMWPrS7AANYqdq6vcBcBUdJCVVFceUvJFjaPdGZ2y9WACViL4L/0))#ggrsrxfy").expect("Valid descriptor with checksum");
1760-
Descriptor::parse_descriptor(&secp, "sh(multi(2,[00000000/111'/222]xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0))#tjg09x5t").expect("Valid descriptor with checksum");
1759+
Descriptor::parse_descriptor(secp, "sh(multi(2,[00000000/111'/222]xprvA1RpRA33e1JQ7ifknakTFpgNXPmW2YvmhqLQYMmrj4xJXXWYpDPS3xz7iAxn8L39njGVyuoseXzU6rcxFLJ8HFsTjSyQbLYnMpCqE2VbFWc,xprv9uPDJpEQgRQfDcW7BkF7eTya6RPxXeJCqCJGHuCJ4GiRVLzkTXBAJMu2qaMWPrS7AANYqdq6vcBcBUdJCVVFceUvJFjaPdGZ2y9WACViL4L/0))#ggrsrxfy").expect("Valid descriptor with checksum");
1760+
Descriptor::parse_descriptor(secp, "sh(multi(2,[00000000/111'/222]xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/0))#tjg09x5t").expect("Valid descriptor with checksum");
17611761
}
17621762

17631763
#[test]
@@ -1787,7 +1787,7 @@ pk(03f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8))";
17871787
let secp = &secp256k1::Secp256k1::signing_only();
17881788
let descriptor_str = "wpkh(xprv9s21ZrQH143K4CTb63EaMxja1YiTnSEWKMbn23uoEnAzxjdUJRQkazCAtzxGm4LSoTSVTptoV9RbchnKPW9HxKtZumdyxyikZFDLhogJ5Uj/44'/0'/0'/0/*)#v20xlvm9";
17891789
let (descriptor, keymap) =
1790-
Descriptor::<DescriptorPublicKey>::parse_descriptor(&secp, descriptor_str).unwrap();
1790+
Descriptor::<DescriptorPublicKey>::parse_descriptor(secp, descriptor_str).unwrap();
17911791

17921792
let expected = "wpkh([a12b02f4/44'/0'/0']xpub6BzhLAQUDcBUfHRQHZxDF2AbcJqp4Kaeq6bzJpXrjrWuK26ymTFwkEFbxPra2bJ7yeZKbDjfDeFwxe93JMqpo5SsPJH6dZdvV9kMzJkAZ69/0/*)#u37l7u8u";
17931793
assert_eq!(expected, descriptor.to_string());

src/interpreter/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ mod tests {
11461146
stack,
11471147
public_key: None,
11481148
state: vec![NodeEvaluationState {
1149-
node: &ms,
1149+
node: ms,
11501150
n_evaluated: 0,
11511151
n_satisfied: 0,
11521152
}],

src/miniscript/astelem.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Terminal<Pk, Ctx> {
129129
Terminal::RawPkH(ref p) => Terminal::RawPkH(*p),
130130
Terminal::After(n) => Terminal::After(n),
131131
Terminal::Older(n) => Terminal::Older(n),
132-
Terminal::Sha256(ref x) => Terminal::Sha256(t.sha256(&x)?),
133-
Terminal::Hash256(ref x) => Terminal::Hash256(t.hash256(&x)?),
134-
Terminal::Ripemd160(ref x) => Terminal::Ripemd160(t.ripemd160(&x)?),
135-
Terminal::Hash160(ref x) => Terminal::Hash160(t.hash160(&x)?),
132+
Terminal::Sha256(ref x) => Terminal::Sha256(t.sha256(x)?),
133+
Terminal::Hash256(ref x) => Terminal::Hash256(t.hash256(x)?),
134+
Terminal::Ripemd160(ref x) => Terminal::Ripemd160(t.ripemd160(x)?),
135+
Terminal::Hash160(ref x) => Terminal::Hash160(t.hash160(x)?),
136136
Terminal::True => Terminal::True,
137137
Terminal::False => Terminal::False,
138138
Terminal::Alt(ref sub) => Terminal::Alt(Arc::new(sub.real_translate_pk(t)?)),
@@ -622,7 +622,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Terminal<Pk, Ctx> {
622622
Terminal::RawPkH(ref hash) => builder
623623
.push_opcode(opcodes::all::OP_DUP)
624624
.push_opcode(opcodes::all::OP_HASH160)
625-
.push_slice(&hash)
625+
.push_slice(hash)
626626
.push_opcode(opcodes::all::OP_EQUALVERIFY),
627627
Terminal::After(t) => builder
628628
.push_int(t.to_u32().into())
@@ -635,28 +635,28 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Terminal<Pk, Ctx> {
635635
.push_int(32)
636636
.push_opcode(opcodes::all::OP_EQUALVERIFY)
637637
.push_opcode(opcodes::all::OP_SHA256)
638-
.push_slice(&Pk::to_sha256(&h))
638+
.push_slice(&Pk::to_sha256(h))
639639
.push_opcode(opcodes::all::OP_EQUAL),
640640
Terminal::Hash256(ref h) => builder
641641
.push_opcode(opcodes::all::OP_SIZE)
642642
.push_int(32)
643643
.push_opcode(opcodes::all::OP_EQUALVERIFY)
644644
.push_opcode(opcodes::all::OP_HASH256)
645-
.push_slice(&Pk::to_hash256(&h))
645+
.push_slice(&Pk::to_hash256(h))
646646
.push_opcode(opcodes::all::OP_EQUAL),
647647
Terminal::Ripemd160(ref h) => builder
648648
.push_opcode(opcodes::all::OP_SIZE)
649649
.push_int(32)
650650
.push_opcode(opcodes::all::OP_EQUALVERIFY)
651651
.push_opcode(opcodes::all::OP_RIPEMD160)
652-
.push_slice(&Pk::to_ripemd160(&h))
652+
.push_slice(&Pk::to_ripemd160(h))
653653
.push_opcode(opcodes::all::OP_EQUAL),
654654
Terminal::Hash160(ref h) => builder
655655
.push_opcode(opcodes::all::OP_SIZE)
656656
.push_int(32)
657657
.push_opcode(opcodes::all::OP_EQUALVERIFY)
658658
.push_opcode(opcodes::all::OP_HASH160)
659-
.push_slice(&Pk::to_hash160(&h))
659+
.push_slice(&Pk::to_hash160(h))
660660
.push_opcode(opcodes::all::OP_EQUAL),
661661
Terminal::True => builder.push_opcode(opcodes::OP_TRUE),
662662
Terminal::False => builder.push_opcode(opcodes::OP_FALSE),

0 commit comments

Comments
 (0)