mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Add test for partial range
This commit is contained in:
parent
c7e3e304d5
commit
1d0acce984
1 changed files with 11 additions and 0 deletions
|
@ -25,4 +25,15 @@ fn range_to() {
|
|||
v.drain(..v.len()); // Nay
|
||||
}
|
||||
|
||||
fn partial_drains() {
|
||||
let mut v = vec![1, 2, 3];
|
||||
v.drain(1..); // Yay
|
||||
|
||||
let mut v = vec![1, 2, 3];
|
||||
v.drain(..v.len() - 1); // Yay
|
||||
|
||||
let mut v = vec![1, 2, 3];
|
||||
v.drain(1..v.len() - 1); // Yay
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
Loading…
Reference in a new issue