]> git.lizzy.rs Git - rust.git/commitdiff
Add test cases for possible missing comma lint
authorBood Qian <bood@glowing.com>
Sat, 4 Feb 2017 12:02:53 +0000 (20:02 +0800)
committerBood Qian <bood@glowing.com>
Sat, 4 Feb 2017 12:02:53 +0000 (20:02 +0800)
tests/compile-fail/formatting.rs

index 096132b70937e405518763c8f109bda5312c2913..6c6671b0aa40ef186e09a6f125e3fb888c39667d 100644 (file)
@@ -98,10 +98,30 @@ fn main() {
     b = !false;
 
     // possible missing comma in an array
-    let mut c = &[
+    let _ = &[
         -1, -2, -3 // <= no coma here
         //~^ ERROR possibly missing a comma here
         //~| NOTE to remove this lint, add a comma or write the expr in a single line
         -4, -5, -6
     ];
+    let _ = &[
+        -1, -2, -3 // <= no coma here
+        //~^ ERROR possibly missing a comma here
+        //~| NOTE to remove this lint, add a comma or write the expr in a single line
+        *4, -5, -6
+    ];
+
+    // those are ok:
+    let _ = &[
+        -1, -2, -3,
+        -4, -5, -6
+    ];
+    let _ = &[
+        -1, -2, -3,
+        -4, -5, -6,
+    ];
+    let _ = &[
+        1 + 2, 3 +
+        4, 5 + 6,
+    ];
 }