From e23e46a06eb568a2ce32337e04002d35889870d0 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 12 Dec 2021 13:56:13 -0800 Subject: [PATCH] Resolve useless_vec clippy lint in benchmark runner error: useless use of `vec!` --> benches/rust.rs:120:13 | 120 | / vec![ 121 | | $( 122 | | $(#[$cfg])* 123 | | (stringify!($name), $name::bench as fn(&str) -> Result<(), ()>), 124 | | )* 125 | | ] | |_____________^ help: you can use a slice directly: `&[(stringify!($name), $name::bench as fn(&str) -> Result<(), ()>)]` ... 141 | for (name, f) in testcases!( | ______________________- 142 | | #[cfg(not(syn_only))] 143 | | read_from_disk, 144 | | #[cfg(not(syn_only))] ... | 148 | | librustc_parse, 149 | | ) { | |_____- in this macro invocation | = note: `-D clippy::useless-vec` implied by `-D clippy::all` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec = note: this error originates in the macro `testcases` (in Nightly builds, run with -Z macro-backtrace for more info) --- benches/rust.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benches/rust.rs b/benches/rust.rs index 538db1c14d..54542932ae 100644 --- a/benches/rust.rs +++ b/benches/rust.rs @@ -5,7 +5,7 @@ #![cfg_attr(not(syn_only), feature(rustc_private))] #![recursion_limit = "1024"] -#![allow(clippy::cast_lossless, clippy::unnecessary_wraps, clippy::useless_vec)] +#![allow(clippy::cast_lossless, clippy::unnecessary_wraps)] #[macro_use] #[path = "../tests/macros/mod.rs"] @@ -117,7 +117,7 @@ fn main() { macro_rules! testcases { ($($(#[$cfg:meta])* $name:ident,)*) => { - vec![ + [ $( $(#[$cfg])* (stringify!($name), $name::bench as fn(&str) -> Result<(), ()>),