From c0c88fe87d151c33a0fe79cd57f04eecddf88362 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 7 Jun 2022 15:23:35 +1000 Subject: [PATCH] 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. --- src/util/bip158.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/util/bip158.rs b/src/util/bip158.rs index f736d80e..34079624 100644 --- a/src/util/bip158.rs +++ b/src/util/bip158.rs @@ -618,19 +618,13 @@ mod test { let bytes = out; { - let mut query = Vec::new(); - query.push(Vec::from_hex("abcdef").unwrap()); - query.push(Vec::from_hex("eeeeee").unwrap()); - + let query = vec![Vec::from_hex("abcdef").unwrap(), Vec::from_hex("eeeeee").unwrap()]; let reader = GCSFilterReader::new(0, 0, M, P); let mut input = Cursor::new(bytes.clone()); assert!(reader.match_any(&mut input, &mut query.iter().map(|v| v.as_slice())).unwrap()); } { - let mut query = Vec::new(); - query.push(Vec::from_hex("abcdef").unwrap()); - query.push(Vec::from_hex("123456").unwrap()); - + let query = vec![Vec::from_hex("abcdef").unwrap(), Vec::from_hex("123456").unwrap()]; let reader = GCSFilterReader::new(0, 0, M, P); let mut input = Cursor::new(bytes.clone()); assert!(!reader.match_any(&mut input, &mut query.iter().map(|v| v.as_slice())).unwrap());