Don't match on complex expression

Passing a complex expression to `match` is hard to read. Assign it to a
variable first.
This commit is contained in:
Martin Habovstiak 2023-12-19 19:02:06 +01:00 committed by Andrew Poelstra
parent 6cdbb04820
commit 5fd731f095
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 5 additions and 3 deletions

View File

@ -1929,7 +1929,8 @@ mod tests {
let mut witness: Vec<_> = spending.input[1].witness.to_vec();
witness[0][10] = 42;
spending.input[1].witness = Witness::from_slice(&witness);
match spending
let error = spending
.verify(|point: &OutPoint| {
if let Some(tx) = spent3.remove(&point.txid) {
return tx.output.get(point.vout as usize).cloned();
@ -1937,8 +1938,9 @@ mod tests {
None
})
.err()
.unwrap()
{
.unwrap();
match error {
TxVerifyError::ScriptVerification(_) => {}
_ => panic!("Wrong error type"),
}