about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui-toml/useless_vec/useless_vec.fixed
blob: 6181abc6ea5765f3adc53a90d3eec3f6cf794475 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//@compile-flags: --test
#![warn(clippy::useless_vec)]
#![allow(clippy::unnecessary_operation, clippy::no_effect)]

fn foo(_: &[u32]) {}

fn main() {
    foo(&[1_u32]);
    //~^ useless_vec
}

#[test]
pub fn in_test() {
    foo(&vec![2_u32]);
}

#[cfg(test)]
fn in_cfg_test() {
    foo(&vec![3_u32]);
}

#[cfg(test)]
mod mod1 {
    fn in_cfg_test_mod() {
        super::foo(&vec![4_u32]);
    }
}