-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't havegood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
fn main() {
let mut v = vec![3, 2, 1];
v.splice(0..0, std::iter::repeat(0).take(4));
println!("{:?}", v); // [0, 0, 0, 0, 3, 2, 1]
}
error: this range is empty so it will yield no values
--> src/main.rs:3:14
|
3 | v.splice(0..0, std::iter::repeat(0).take(4));
| ^^^^
|
= note: `#[deny(clippy::reversed_empty_ranges)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#reversed_empty_ranges
I believe this is a correct use of an empty range.
https://doc.rust-lang.org/std/vec/struct.Vec.html#method.splice
Mentioning @ebroto @yaahc who touched this lint recently in #5583.
clippy 0.0.212 (826cb06 2020-06-05)
flip1995
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't havegood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy