mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
25 lines
461 B
Rust
25 lines
461 B
Rust
// run-rustfix
|
|
#![warn(clippy::iter_next_slice)]
|
|
|
|
fn main() {
|
|
// test code goes here
|
|
let s = [1, 2, 3];
|
|
let v = vec![1, 2, 3];
|
|
|
|
s.get(0);
|
|
// Should be replaced by s.get(0)
|
|
|
|
s.get(2);
|
|
// Should be replaced by s.get(2)
|
|
|
|
v.get(5);
|
|
// Should be replaced by v.get(5)
|
|
|
|
v.get(0);
|
|
// Should be replaced by v.get(0)
|
|
|
|
let o = Some(5);
|
|
o.iter().next();
|
|
// Shouldn't be linted since this is not a Slice or an Array
|
|
}
|