Skip to content

Commit f33c73d

Browse files
committed
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.
1 parent d9f844b commit f33c73d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/blockdata/transaction.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,18 +1208,13 @@ mod tests {
12081208
#[test]
12091209
fn sighash_single_bug() {
12101210
const SIGHASH_SINGLE: u32 = 3;
1211-
// We need a tx with more inputs than outputs.
1212-
let mut input = Vec::new();
1213-
input.push(TxIn::default());
1214-
input.push(TxIn::default());
1215-
let mut output = Vec::new();
1216-
output.push(TxOut::default());
12171211

1212+
// We need a tx with more inputs than outputs.
12181213
let tx = Transaction {
12191214
version: 1,
12201215
lock_time: 0,
1221-
input: input,
1222-
output: output, // TODO: Use Vec::from([TxOut]) once we bump MSRV.
1216+
input: vec![TxIn::default(), TxIn::default()],
1217+
output: vec![TxOut::default()],
12231218
};
12241219
let script = Script::new();
12251220
let got = tx.signature_hash(1, &script, SIGHASH_SINGLE);

0 commit comments

Comments
 (0)