From 0a19710906f35477a486f1f717b8c64da5c1e18c Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 21 Apr 2022 11:12:23 +1000 Subject: [PATCH] Use vec! macro instead of new followed by push No need to manually create a vector and push each element, just use the `vec![]` macro. --- src/blockdata/transaction.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/blockdata/transaction.rs b/src/blockdata/transaction.rs index d4cd54d6..47e56234 100644 --- a/src/blockdata/transaction.rs +++ b/src/blockdata/transaction.rs @@ -1208,18 +1208,13 @@ mod tests { #[test] fn sighash_single_bug() { const SIGHASH_SINGLE: u32 = 3; - // We need a tx with more inputs than outputs. - let mut input = Vec::new(); - input.push(TxIn::default()); - input.push(TxIn::default()); - let mut output = Vec::new(); - output.push(TxOut::default()); + // We need a tx with more inputs than outputs. let tx = Transaction { version: 1, lock_time: 0, - input: input, - output: output, // TODO: Use Vec::from([TxOut]) once we bump MSRV. + input: vec![TxIn::default(), TxIn::default()], + output: vec![TxOut::default()], }; let script = Script::new(); let got = tx.signature_hash(1, &script, SIGHASH_SINGLE);