Skip to content

Commit 30c40a3

Browse files
committed
clippy: fix redundant_closure_for_method_calls lint
Essentially just a style thing; I think it's nicer to be explicit about what type we're calling methods on, and I think it's nicer to avoid the closure syntax when we can.
1 parent e536bd4 commit 30c40a3

5 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/blind.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,12 +715,13 @@ impl TxOut {
715715
{
716716
let value_blind_inputs = spent_utxo_secrets
717717
.iter()
718-
.map(|utxo_sec| utxo_sec.value_blind_inputs())
718+
.map(TxOutSecrets::value_blind_inputs)
719719
.collect::<Vec<_>>();
720720

721721
let value_blind_outputs = output_secrets
722722
.iter()
723-
.map(|e| e.value_blind_inputs())
723+
.copied()
724+
.map(TxOutSecrets::value_blind_inputs)
724725
.collect::<Vec<_>>();
725726

726727
let out_vbf = ValueBlindingFactor::last(

src/pset/map/input.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ impl Input {
481481
self.sighash_type
482482
.map_or(
483483
Some(EcdsaSighashType::All),
484-
|sighash_type| sighash_type.ecdsa_hash_ty(),
484+
PsbtSighashType::ecdsa_hash_ty,
485485
)
486486
}
487487

@@ -495,7 +495,7 @@ impl Input {
495495
self.sighash_type
496496
.map_or(
497497
Some(SchnorrSighashType::Default),
498-
|sighash_type| sighash_type.schnorr_hash_ty(),
498+
PsbtSighashType::schnorr_hash_ty,
499499
)
500500
}
501501

src/pset/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,12 @@ impl PartiallySignedTransaction {
296296
script_witness: psetin
297297
.final_script_witness
298298
.as_ref()
299-
.map(|x| x.to_owned())
299+
.map(Vec::to_owned)
300300
.unwrap_or_default(),
301301
pegin_witness: psetin
302302
.pegin_witness
303303
.as_ref()
304-
.map(|x| x.to_owned())
304+
.map(Vec::to_owned)
305305
.unwrap_or_default(),
306306
},
307307
};

src/sighash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<T> Prevouts<'_, T> where T: Borrow<TxOut> {
195195
}
196196
Prevouts::All(prevouts) => prevouts
197197
.get(input_index)
198-
.map(|x| x.borrow())
198+
.map(T::borrow)
199199
.ok_or(Error::PrevoutIndex),
200200
}
201201
}

src/taproot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ impl TaprootMerkleBranch {
571571

572572
/// Serialize self as bytes
573573
pub fn serialize(&self) -> Vec<u8> {
574-
self.0.iter().flat_map(|e| e.as_byte_array()).copied().collect::<Vec<u8>>()
574+
self.0.iter().flat_map(sha256::Hash::as_byte_array).copied().collect::<Vec<u8>>()
575575
}
576576

577577
// Internal function to append elements to proof

0 commit comments

Comments
 (0)