Skip to content

Commit 1f7c0b6

Browse files
committed
fix(rpc/test): clippy map_or_else + redundant closure on merkle_root construction
The smoke fixture in commit 6f93ded uses bitcoin::merkle_tree::calculate_root to derive the merkle root from a single-tx block. The map(...).unwrap_or_else() chain triggered clippy::map_unwrap_or, and the closure was a redundant wrapper for TxMerkleNode::from_raw_hash. Replace with map_or_else passing the two associated functions directly. Op: correct Restores: rule:clippy_workspace_clean
1 parent 6f93ded commit 1f7c0b6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

crates/rpc/tests/handler_smoke.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,10 @@ impl Fixture {
350350
merkle_root: bitcoin::merkle_tree::calculate_root(std::iter::once(
351351
tx.compute_txid().to_raw_hash(),
352352
))
353-
.map(|root| bitcoin::TxMerkleNode::from_raw_hash(root))
354-
.unwrap_or_else(bitcoin::TxMerkleNode::all_zeros),
353+
.map_or_else(
354+
bitcoin::TxMerkleNode::all_zeros,
355+
bitcoin::TxMerkleNode::from_raw_hash,
356+
),
355357
time: 1_231_006_505,
356358
bits: bitcoin::CompactTarget::from_consensus(0x1d00_ffff),
357359
nonce: 0,

0 commit comments

Comments
 (0)