mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-26 22:50:56 +00:00
more tests
This commit is contained in:
parent
2177f2cb96
commit
85e1646afc
6 changed files with 32 additions and 2 deletions
|
@ -6,6 +6,10 @@ fn main() {
|
|||
let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().flatten();
|
||||
//~^ HELP: consider using `flatten` instead
|
||||
|
||||
#[rustfmt::skip]
|
||||
let _ = vec![Ok(1), Err(2)].into_iter().flatten();
|
||||
//~^ HELP: consider using `flatten` instead
|
||||
|
||||
// Don't lint below
|
||||
let mut counter = 0;
|
||||
let _ = vec![Ok(1), Err(2)].into_iter().filter(|o| {
|
||||
|
|
|
@ -6,6 +6,10 @@ fn main() {
|
|||
let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().filter(|a| a.is_ok());
|
||||
//~^ HELP: consider using `flatten` instead
|
||||
|
||||
#[rustfmt::skip]
|
||||
let _ = vec![Ok(1), Err(2)].into_iter().filter(|o| { o.is_ok() });
|
||||
//~^ HELP: consider using `flatten` instead
|
||||
|
||||
// Don't lint below
|
||||
let mut counter = 0;
|
||||
let _ = vec![Ok(1), Err(2)].into_iter().filter(|o| {
|
||||
|
|
|
@ -13,5 +13,11 @@ error: `filter` for `is_ok` on iterator over `Result`s
|
|||
LL | let _ = vec![Ok(1), Err(2), Ok(3)].into_iter().filter(|a| a.is_ok());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: `filter` for `is_ok` on iterator over `Result`s
|
||||
--> $DIR/iter_filter_is_ok.rs:10:45
|
||||
|
|
||||
LL | let _ = vec![Ok(1), Err(2)].into_iter().filter(|o| { o.is_ok() });
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
@ -6,12 +6,17 @@ fn main() {
|
|||
let _ = vec![Some(1)].into_iter().flatten();
|
||||
//~^ HELP: consider using `flatten` instead
|
||||
|
||||
#[rustfmt::skip]
|
||||
let _ = vec![Some(1)].into_iter().flatten();
|
||||
//~^ HELP: consider using `flatten` instead
|
||||
|
||||
// Don't lint below
|
||||
let mut counter = 0;
|
||||
let _ = vec![Some(1)].into_iter().filter(|o| {
|
||||
counter += 1;
|
||||
o.is_some()
|
||||
});
|
||||
|
||||
let _ = vec![Some(1)].into_iter().filter(|o| {
|
||||
// Roses are red,
|
||||
// Violets are blue,
|
||||
|
|
|
@ -6,12 +6,17 @@ fn main() {
|
|||
let _ = vec![Some(1)].into_iter().filter(|o| o.is_some());
|
||||
//~^ HELP: consider using `flatten` instead
|
||||
|
||||
#[rustfmt::skip]
|
||||
let _ = vec![Some(1)].into_iter().filter(|o| { o.is_some() });
|
||||
//~^ HELP: consider using `flatten` instead
|
||||
|
||||
// Don't lint below
|
||||
let mut counter = 0;
|
||||
let _ = vec![Some(1)].into_iter().filter(|o| {
|
||||
counter += 1;
|
||||
o.is_some()
|
||||
});
|
||||
|
||||
let _ = vec![Some(1)].into_iter().filter(|o| {
|
||||
// Roses are red,
|
||||
// Violets are blue,
|
||||
|
|
|
@ -13,5 +13,11 @@ error: `filter` for `is_some` on iterator over `Option`
|
|||
LL | let _ = vec![Some(1)].into_iter().filter(|o| o.is_some());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: `filter` for `is_some` on iterator over `Option`
|
||||
--> $DIR/iter_filter_is_some.rs:10:39
|
||||
|
|
||||
LL | let _ = vec![Some(1)].into_iter().filter(|o| { o.is_some() });
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `flatten()`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue