Add tests for slice_iter_nth

This commit is contained in:
Devon Hollowood 2016-06-16 01:29:03 -07:00
parent 06fd2468b2
commit 555e4555b1

View File

@ -309,6 +309,15 @@ fn or_fun_call() {
//~|SUGGESTION btree.entry(42).or_insert_with(String::new);
}
/// Checks implementation of `SLICE_ITER_NTH` lint
fn slice_iter_nth() {
let some_vec = vec![0, 1, 2, 3];
let bad = &some_vec[..].iter().nth(3);
//~^ERROR called `.iter().nth()` on a slice.
let ok = some_vec.iter().nth(3); // This should be okay, since some_vec is not a slice
}
#[allow(similar_names)]
fn main() {
use std::io;