Use vec instead of pushing to a mutable vector

Clippy emits:

  warning: calls to `push` immediately after creation

Use `vec` instead of pushing to a mutable vector.
This commit is contained in:
Tobin C. Harding 2022-06-07 15:23:35 +10:00
parent 73066e7e48
commit c0c88fe87d
1 changed files with 2 additions and 8 deletions

View File

@ -618,19 +618,13 @@ mod test {
let bytes = out; let bytes = out;
{ {
let mut query = Vec::new(); let query = vec![Vec::from_hex("abcdef").unwrap(), Vec::from_hex("eeeeee").unwrap()];
query.push(Vec::from_hex("abcdef").unwrap());
query.push(Vec::from_hex("eeeeee").unwrap());
let reader = GCSFilterReader::new(0, 0, M, P); let reader = GCSFilterReader::new(0, 0, M, P);
let mut input = Cursor::new(bytes.clone()); let mut input = Cursor::new(bytes.clone());
assert!(reader.match_any(&mut input, &mut query.iter().map(|v| v.as_slice())).unwrap()); assert!(reader.match_any(&mut input, &mut query.iter().map(|v| v.as_slice())).unwrap());
} }
{ {
let mut query = Vec::new(); let query = vec![Vec::from_hex("abcdef").unwrap(), Vec::from_hex("123456").unwrap()];
query.push(Vec::from_hex("abcdef").unwrap());
query.push(Vec::from_hex("123456").unwrap());
let reader = GCSFilterReader::new(0, 0, M, P); let reader = GCSFilterReader::new(0, 0, M, P);
let mut input = Cursor::new(bytes.clone()); let mut input = Cursor::new(bytes.clone());
assert!(!reader.match_any(&mut input, &mut query.iter().map(|v| v.as_slice())).unwrap()); assert!(!reader.match_any(&mut input, &mut query.iter().map(|v| v.as_slice())).unwrap());