rust-clippy/tests/ui/vec_resize_to_zero.rs
2022-08-19 10:54:55 -04:00

19 lines
365 B
Rust

#![warn(clippy::vec_resize_to_zero)]
fn main() {
let mut v = vec![1, 2, 3, 4, 5];
// applicable here
v.resize(0, 5);
// 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")
}