]> git.lizzy.rs Git - rust.git/commitdiff
happy slice
authorJeroen Vannevel <jer_vannevel@outlook.com>
Fri, 14 Jan 2022 01:20:40 +0000 (01:20 +0000)
committerJeroen Vannevel <jer_vannevel@outlook.com>
Fri, 14 Jan 2022 01:32:12 +0000 (01:32 +0000)
crates/ide_assists/src/handlers/merge_match_arms.rs

index 209d352c78d49401d1c4dd3568e840ed66751185..5337b968c5c16e7290524d01cb36112f7a68d242 100644 (file)
@@ -791,4 +791,39 @@ fn func(binary: &[u8]) {
         "#,
         )
     }
+
+    #[test]
+    fn merge_match_arms_slice_identical() {
+        check_assist(
+            merge_match_arms,
+            r#"
+fn func(binary: &[u8]) {
+    let space = b' ';
+    match binary {
+        [space, 5u8] => $0"",
+        [space] => "",
+        _ => "other",
+    };
 }
+        "#,
+                    r#"
+fn func(binary: &[u8]) {
+    let space = b' ';
+    match binary {
+        [space, 5u8] | [space] => "",
+        _ => "other",
+    };
+}
+        "#,
+        )
+    }
+}
+
+fn func(binary: &[u8]) {
+    let space = b' ';
+    match binary {
+        [space, 5u8] => "",
+        [space] => "",
+        _ => "other",
+    };
+}
\ No newline at end of file