mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 12:44:40 +00:00
prepare test for 8734
This commit is contained in:
parent
22673bce4c
commit
04297de2ed
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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(|_| {
|
||||
| __________^
|
||||
|
Loading…
Reference in New Issue
Block a user