summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/vec_resize_to_zero.rs
blob: 7ed27439ec6e4432372224dd696d485024918b96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#![warn(clippy::vec_resize_to_zero)]

fn main() {
    // applicable here
    vec![1, 2, 3, 4, 5].resize(0, 5);

    // not applicable
    vec![1, 2, 3, 4, 5].resize(2, 5);

    // applicable here, but only implemented for integer literals for now
    vec!["foo", "bar", "baz"].resize(0, "bar");

    // not applicable
    vec!["foo", "bar", "baz"].resize(2, "bar")
}