mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
24 lines
513 B
Rust
24 lines
513 B
Rust
#![warn(clippy::iter_next_slice)]
|
|
#![allow(clippy::useless_vec)]
|
|
|
|
fn main() {
|
|
// test code goes here
|
|
let s = [1, 2, 3];
|
|
let v = vec![1, 2, 3];
|
|
|
|
let _ = s.first();
|
|
// Should be replaced by s.first()
|
|
|
|
let _ = s.get(2);
|
|
// Should be replaced by s.get(2)
|
|
|
|
let _ = v.get(5);
|
|
// Should be replaced by v.get(5)
|
|
|
|
let _ = v.first();
|
|
// Should be replaced by v.first()
|
|
|
|
let o = Some(5);
|
|
o.iter().next();
|
|
// Shouldn't be linted since this is not a Slice or an Array
|
|
}
|