about summary refs log tree commit diff
path: root/tests/ui/vec_resize_to_zero.rs
blob: 2b75b475223ce9a2e814fd1880daefabc3a70aaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#![warn(clippy::vec_resize_to_zero)]

fn main() {
    let mut v = vec![1, 2, 3, 4, 5];

    // applicable here
    v.resize(0, 5);
    //~^ vec_resize_to_zero


    // not applicable
    v.resize(2, 5);

    let mut v = vec!["foo", "bar", "baz"];

    // applicable here, but only implemented for integer literals for now
    v.resize(0, "bar");

    // not applicable
    v.resize(2, "bar")
}