Skip to content

Commit

Permalink
Use unwrap_or_else instead of expect
Browse files Browse the repository at this point in the history
Clippy emits:

  warning: use of `expect` followed by a function call

As suggested, use `unwrap_or_else` with `panic!`.
  • Loading branch information
tcharding committed May 16, 2024
1 parent a1a5467 commit ef868cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bitcoind-tests/tests/test_cpp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ pub fn test_from_cpp_ms(cl: &Client, testdata: &TestData) {
// Check whether the node accepts the transactions
let txid = cl
.send_raw_transaction(&tx)
.expect(&format!("{} send tx failed for ms {}", i, ms));
.unwrap_or_else(|_| panic!("{} send tx failed for ms {}", i, ms));
spend_txids.push(txid);
}
}
Expand Down
2 changes: 1 addition & 1 deletion bitcoind-tests/tests/test_desc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ pub fn test_desc_satisfy(
// Check whether the node accepts the transactions
let txid = cl
.send_raw_transaction(&tx)
.expect(&format!("send tx failed for desc {}", definite_desc));
.unwrap_or_else(|_| panic!("send tx failed for desc {}", definite_desc));

// Finally mine the blocks and await confirmations
let _blocks = cl
Expand Down

0 comments on commit ef868cc

Please sign in to comment.