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.
This commit is contained in:
Tobin C. Harding 2022-04-21 11:12:23 +10:00
parent 83514c87a7
commit 0a19710906
1 changed files with 3 additions and 8 deletions

View File

@ -1208,18 +1208,13 @@ mod tests {
#[test] #[test]
fn sighash_single_bug() { fn sighash_single_bug() {
const SIGHASH_SINGLE: u32 = 3; 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 { let tx = Transaction {
version: 1, version: 1,
lock_time: 0, lock_time: 0,
input: input, input: vec![TxIn::default(), TxIn::default()],
output: output, // TODO: Use Vec::from([TxOut]) once we bump MSRV. output: vec![TxOut::default()],
}; };
let script = Script::new(); let script = Script::new();
let got = tx.signature_hash(1, &script, SIGHASH_SINGLE); let got = tx.signature_hash(1, &script, SIGHASH_SINGLE);