Skip to content

Commit 592b479

Browse files
committed
Use copied
Now we have Rust 1.31 we can use `copied`. Clears clippy warning.
1 parent 54f2384 commit 592b479

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/miniscript/satisfy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl<Pk: MiniscriptKey + ToPublicKey> Satisfier<Pk> for After {
168168

169169
impl<Pk: MiniscriptKey + ToPublicKey> Satisfier<Pk> for HashMap<Pk, bitcoin::EcdsaSig> {
170170
fn lookup_ecdsa_sig(&self, key: &Pk) -> Option<bitcoin::EcdsaSig> {
171-
self.get(key).map(|x| *x)
171+
self.get(key).copied()
172172
}
173173
}
174174

@@ -180,7 +180,7 @@ impl<Pk: MiniscriptKey + ToPublicKey> Satisfier<Pk>
180180
// If we change the signature the of lookup_tap_leaf_script_sig to accept a tuple. We would
181181
// face the same problem while satisfying PkK.
182182
// We use this signature to optimize for the psbt common use case.
183-
self.get(&(key.clone(), *h)).map(|x| *x)
183+
self.get(&(key.clone(), *h)).copied()
184184
}
185185
}
186186

src/psbt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl<'psbt, Pk: MiniscriptKey + ToPublicKey> Satisfier<Pk> for PsbtInputSatisfie
262262
self.psbt.inputs[self.index]
263263
.tap_script_sigs
264264
.get(&(pk.to_x_only_pubkey(), *lh))
265-
.map(|x| *x) // replace by copied in 1.36
265+
.copied()
266266
}
267267

268268
fn lookup_tap_control_block_map(
@@ -289,7 +289,7 @@ impl<'psbt, Pk: MiniscriptKey + ToPublicKey> Satisfier<Pk> for PsbtInputSatisfie
289289
self.psbt.inputs[self.index]
290290
.partial_sigs
291291
.get(&pk.to_public_key())
292-
.map(|sig| *sig)
292+
.copied()
293293
}
294294

295295
fn lookup_pkh_ecdsa_sig(

0 commit comments

Comments
 (0)