fix tests

This commit is contained in:
Oliver Schneider 2016-06-21 14:46:02 +02:00
parent 415ddfb630
commit ac6e7b2957
No known key found for this signature in database
GPG Key ID: 56D6EEA0FC67AC46
2 changed files with 9 additions and 4 deletions

View File

@ -3,13 +3,18 @@
#![deny(clippy, clippy_pedantic)]
fn main() {
let _: Vec<_> = vec![5; 6].into_iter() //~ERROR called `filter(p).map(q)` on an Iterator
let _: Vec<_> = vec![5; 6].into_iter() //~ERROR called `filter(p).map(q)` on an `Iterator`
.filter(|&x| x == 0)
.map(|x| x * 2)
.collect();
let _: Vec<_> = vec![5i8; 6].into_iter() //~ERROR called `filter(p).flat_map(q)` on an Iterator
let _: Vec<_> = vec![5i8; 6].into_iter() //~ERROR called `filter(p).flat_map(q)` on an `Iterator`
.filter(|&x| x == 0)
.flat_map(|x| x.checked_mul(2))
.collect();
let _: Vec<_> = vec![5i8; 6].into_iter() //~ERROR called `filter_map(p).flat_map(q)` on an `Iterator`
.filter_map(|x| x.checked_mul(2))
.flat_map(|x| x.checked_mul(2))
.collect();
}

View File

@ -181,11 +181,11 @@ fn filter_next() {
// check single-line case
let _ = v.iter().filter(|&x| *x < 0).next();
//~^ ERROR called `filter(p).next()` on an Iterator.
//~^ ERROR called `filter(p).next()` on an `Iterator`.
//~| NOTE replace `filter(|&x| *x < 0).next()`
// check multi-line case
let _ = v.iter().filter(|&x| { //~ERROR called `filter(p).next()` on an Iterator.
let _ = v.iter().filter(|&x| { //~ERROR called `filter(p).next()` on an `Iterator`.
*x < 0
}
).next();