more tests

This commit is contained in:
Quinn Sinclair 2023-12-24 17:32:00 +02:00 committed by PartiallyTyped
parent 2177f2cb96
commit 85e1646afc
6 changed files with 32 additions and 2 deletions

View File

@ -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| {

View File

@ -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| {

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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