Remove useless usage of vec! macro

Clippy emits a bunch of warnings of form:

  warning: useless use of `vec!`

As suggested, remove the vec and just use an array.
This commit is contained in:
Tobin C. Harding 2023-08-25 12:30:04 +10:00
parent e84ca292d9
commit 724be17394
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
3 changed files with 4 additions and 5 deletions

View File

@ -2361,8 +2361,7 @@ mod tests {
#[test] #[test]
fn disallow_confusing_forms() { fn disallow_confusing_forms() {
let confusing = let confusing = ["Msat", "Msats", "MSAT", "MSATS", "MSat", "MSats", "MBTC", "Mbtc", "PBTC"];
vec!["Msat", "Msats", "MSAT", "MSATS", "MSat", "MSats", "MBTC", "Mbtc", "PBTC"];
for denom in confusing.iter() { for denom in confusing.iter() {
match Denomination::from_str(denom) { match Denomination::from_str(denom) {
Ok(_) => panic!("from_str should error for {}", denom), Ok(_) => panic!("from_str should error for {}", denom),
@ -2375,7 +2374,7 @@ mod tests {
#[test] #[test]
fn disallow_unknown_denomination() { fn disallow_unknown_denomination() {
// Non-exhaustive list of unknown forms. // Non-exhaustive list of unknown forms.
let unknown = vec!["NBTC", "UBTC", "ABC", "abc", "cBtC", "Sat", "Sats"]; let unknown = ["NBTC", "UBTC", "ABC", "abc", "cBtC", "Sat", "Sats"];
for denom in unknown.iter() { for denom in unknown.iter() {
match Denomination::from_str(denom) { match Denomination::from_str(denom) {
Ok(_) => panic!("from_str should error for {}", denom), Ok(_) => panic!("from_str should error for {}", denom),

View File

@ -616,7 +616,7 @@ mod test {
.unwrap()); .unwrap());
for script in txmap.values() { for script in txmap.values() {
let query = vec![script]; let query = [script];
if !script.is_empty() { if !script.is_empty() {
assert!(filter assert!(filter
.match_any(block_hash, &mut query.iter().map(|s| s.as_bytes())) .match_any(block_hash, &mut query.iter().map(|s| s.as_bytes()))

View File

@ -700,7 +700,7 @@ mod tests {
let txid1 = txids[0]; let txid1 = txids[0];
let txid2 = txids[1]; let txid2 = txids[1];
let txids = vec![txid1, txid2]; let txids = [txid1, txid2];
let merkle_block = MerkleBlock::from_block_with_predicate(&block, |t| txids.contains(t)); let merkle_block = MerkleBlock::from_block_with_predicate(&block, |t| txids.contains(t));