fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error: called `map(..).flatten()` on `Iterator` 2 --> $DIR/map_flatten_fixable.rs:16:47 3 | 4LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id).flatten().collect(); 5 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id)` 6 | 7 = note: `-D clippy::map-flatten` implied by `-D warnings` 8 = help: to override `-D warnings` add `#[allow(clippy::map_flatten)]` 9 10error: called `map(..).flatten()` on `Iterator` 11 --> $DIR/map_flatten_fixable.rs:17:47 12 | 13LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_ref).flatten().collect(); 14 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id_ref)` 15 16error: called `map(..).flatten()` on `Iterator` 17 --> $DIR/map_flatten_fixable.rs:18:47 18 | 19LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(option_id_closure).flatten().collect(); 20 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(option_id_closure)` 21 22error: called `map(..).flatten()` on `Iterator` 23 --> $DIR/map_flatten_fixable.rs:19:47 24 | 25LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect(); 26 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `filter_map` and remove the `.flatten()`: `filter_map(|x| x.checked_add(1))` 27 28error: called `map(..).flatten()` on `Iterator` 29 --> $DIR/map_flatten_fixable.rs:22:47 30 | 31LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect(); 32 | ^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|x| 0..x)` 33 34error: called `map(..).flatten()` on `Option` 35 --> $DIR/map_flatten_fixable.rs:25:40 36 | 37LL | let _: Option<_> = (Some(Some(1))).map(|x| x).flatten(); 38 | ^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|x| x)` 39 40error: called `map(..).flatten()` on `Result` 41 --> $DIR/map_flatten_fixable.rs:28:42 42 | 43LL | let _: Result<_, &str> = (Ok(Ok(1))).map(|x| x).flatten(); 44 | ^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|x| x)` 45 46error: called `map(..).flatten()` on `Iterator` 47 --> $DIR/map_flatten_fixable.rs:37:10 48 | 49LL | .map(|n| match n { 50 | __________^ 51LL | | 1 => [n 52LL | | .saturating_add(1) 53LL | | .saturating_add(1) 54... | 55LL | | }) 56LL | | .flatten(); 57 | |__________________^ 58 | 59help: try replacing `map` with `flat_map` and remove the `.flatten()` 60 | 61LL ~ .flat_map(|n| match n { 62LL + 1 => [n 63LL + .saturating_add(1) 64LL + .saturating_add(1) 65LL + .saturating_add(1) 66LL + .saturating_add(1) 67LL + .saturating_add(1) 68LL + .saturating_add(1) 69LL + .saturating_add(1) 70LL + .saturating_add(1)], 71LL + n => [n], 72LL ~ }); 73 | 74 75error: called `map(..).flatten()` on `Option` 76 --> $DIR/map_flatten_fixable.rs:57:10 77 | 78LL | .map(|_| { 79 | __________^ 80LL | | // we need some newlines 81LL | | // so that the span is big enough 82LL | | // for a split output of the diagnostic 83... | 84LL | | }) 85LL | | .flatten(); 86 | |__________________^ 87 | 88help: try replacing `map` with `and_then` and remove the `.flatten()` 89 | 90LL ~ .and_then(|_| { 91LL + // we need some newlines 92LL + // so that the span is big enough 93LL + // for a split output of the diagnostic 94LL + Some("") 95LL + // whitespace beforehand is important as well 96LL ~ }); 97 | 98 99error: aborting due to 9 previous errors 100