Skip to content

Commit

Permalink
Resolve useless_vec clippy lint in benchmark runner
Browse files Browse the repository at this point in the history
    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)
  • Loading branch information
dtolnay committed Dec 12, 2021
1 parent 22b36c3 commit e23e46a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions benches/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -117,7 +117,7 @@ fn main() {

macro_rules! testcases {
($($(#[$cfg:meta])* $name:ident,)*) => {
vec![
[
$(
$(#[$cfg])*
(stringify!($name), $name::bench as fn(&str) -> Result<(), ()>),
Expand Down

0 comments on commit e23e46a

Please sign in to comment.