diff --git a/tests/ui/map_flatten_fixable.fixed b/tests/ui/map_flatten_fixable.fixed index 08aba35e14d..928e5bd509c 100644 --- a/tests/ui/map_flatten_fixable.fixed +++ b/tests/ui/map_flatten_fixable.fixed @@ -29,9 +29,28 @@ fn main() { // mapping to Result on Result let _: Result<_, &str> = (Ok(Ok(1))).and_then(|x| x); + issue8734(); issue8878(); } +fn issue8734() { + // let _ = [0u8, 1, 2, 3] + // .into_iter() + // .map(|n| match n { + // 1 => [n + // .saturating_add(1) + // .saturating_add(1) + // .saturating_add(1) + // .saturating_add(1) + // .saturating_add(1) + // .saturating_add(1) + // .saturating_add(1) + // .saturating_add(1)], + // n => [n], + // }) + // .flatten(); +} + #[allow(clippy::bind_instead_of_map)] // map + flatten will be suggested to `and_then`, but afterwards `map` is suggested again #[rustfmt::skip] // whitespace is important for this one fn issue8878() { diff --git a/tests/ui/map_flatten_fixable.rs b/tests/ui/map_flatten_fixable.rs index fbe2bf8a37d..4345c6eee74 100644 --- a/tests/ui/map_flatten_fixable.rs +++ b/tests/ui/map_flatten_fixable.rs @@ -29,9 +29,28 @@ fn main() { // mapping to Result on Result let _: Result<_, &str> = (Ok(Ok(1))).map(|x| x).flatten(); + issue8734(); issue8878(); } +fn issue8734() { + // let _ = [0u8, 1, 2, 3] + // .into_iter() + // .map(|n| match n { + // 1 => [n + // .saturating_add(1) + // .saturating_add(1) + // .saturating_add(1) + // .saturating_add(1) + // .saturating_add(1) + // .saturating_add(1) + // .saturating_add(1) + // .saturating_add(1)], + // n => [n], + // }) + // .flatten(); +} + #[allow(clippy::bind_instead_of_map)] // map + flatten will be suggested to `and_then`, but afterwards `map` is suggested again #[rustfmt::skip] // whitespace is important for this one fn issue8878() { diff --git a/tests/ui/map_flatten_fixable.stderr b/tests/ui/map_flatten_fixable.stderr index 5ee2afca1d0..828e24acaad 100644 --- a/tests/ui/map_flatten_fixable.stderr +++ b/tests/ui/map_flatten_fixable.stderr @@ -77,7 +77,7 @@ LL | let _: Result<_, &str> = (Ok(Ok(1))).and_then(|x| x); | ~~~~~~~~~~~~~~~ error: called `map(..).flatten()` on `Option` - --> $DIR/map_flatten_fixable.rs:40:10 + --> $DIR/map_flatten_fixable.rs:59:10 | LL | .map(|_| { | __________^