]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/tests/ui/map_flatten_fixable.fixed
Rollup merge of #100396 - chenyukang:fix-100394, r=petrochenkov
[rust.git] / src / tools / clippy / tests / ui / map_flatten_fixable.fixed
index e9b41354c58fa50599e93f2b39a5dc015f61646d..312819a0a2cf83d567307d788cb5e8c72394561b 100644 (file)
@@ -34,21 +34,20 @@ fn main() {
 }
 
 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();
+    let _ = [0u8, 1, 2, 3]
+        .into_iter()
+        .flat_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],
+        });
 }
 
 #[allow(clippy::bind_instead_of_map)] // map + flatten will be suggested to `and_then`, but afterwards `map` is suggested again
@@ -59,7 +58,7 @@ fn issue8878() {
         .and_then(|_| {
 // we need some newlines
 // so that the span is big enough
-// for a splitted output of the diagnostic
+// for a split output of the diagnostic
             Some("")
  // whitespace beforehand is important as well
         });