From cb83a299fa99498417795e4759d77012e6b727ac Mon Sep 17 00:00:00 2001 From: Bood Qian Date: Sat, 4 Feb 2017 20:02:53 +0800 Subject: [PATCH] Add test cases for possible missing comma lint --- tests/compile-fail/formatting.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/compile-fail/formatting.rs b/tests/compile-fail/formatting.rs index 096132b70937..6c6671b0aa40 100644 --- a/tests/compile-fail/formatting.rs +++ b/tests/compile-fail/formatting.rs @@ -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, + ]; }