]> git.lizzy.rs Git - rust.git/blobdiff - tests/source/issue-3198.rs
Prevent duplicate comma when formatting struct pattern with ".."
[rust.git] / tests / source / issue-3198.rs
index 517533ae562580b285ee082a405f0b59a2ecffa4..48cb24a00259edaff855c4e632c393db0379761a 100644 (file)
@@ -1,9 +1,13 @@
 impl TestTrait {
-    fn foo_one(/* Important comment1 */
+    fn foo_one_pre(/* Important comment1 */
     self) {
     }
 
-    fn foo(
+    fn foo_one_post(self
+    /* Important comment1 */) {
+    }
+
+    fn foo_pre(
         /* Important comment1 */
         self,
         /* Important comment2 */
@@ -11,7 +15,15 @@ fn foo(
     ) {
     }
 
-    fn bar(
+    fn foo_post(
+        self
+        /* Important comment1 */,
+        a: i32
+        /* Important comment2 */,
+    ) {
+    }
+
+    fn bar_pre(
             /* Important comment1 */
     &mut self,
         /* Important comment2 */
@@ -19,7 +31,15 @@ fn bar(
     ) {
     }
 
-    fn baz(
+    fn bar_post(
+    &mut self
+            /* Important comment1 */,
+            a: i32
+        /* Important comment2 */,
+    ) {
+    }
+
+    fn baz_pre(
     /* Important comment1 */
             self: X< 'a ,  'b >,
             /* Important comment2 */
@@ -27,9 +47,16 @@ fn baz(
     ) {
     }
 
-    fn baz_tree(
-    /* Important comment1 */
+    fn baz_post(
+            self: X< 'a ,  'b >
+    /* Important comment1 */,
+    a: i32
+            /* Important comment2 */,
+    ) {
+    }
 
+    fn baz_tree_pre(
+    /* Important comment1 */
             self: X< 'a ,  'b >,
         /* Important comment2 */
         a: i32,
@@ -37,4 +64,36 @@ fn baz_tree(
         b: i32,
     ) {
     }
+
+    fn baz_tree_post(
+            self: X< 'a ,  'b >
+    /* Important comment1 */,
+        a: i32
+        /* Important comment2 */,
+        b: i32
+        /* Important comment3 */,){
+    }
+
+    fn multi_line(
+        self: X<'a, 'b>, /* Important comment1-1 */
+  /* Important comment1-2 */
+        a: i32, /* Important comment2 */
+        b: i32, /* Important comment3 */
+    ) {
+    }
+
+    fn two_line_comment(
+        self: X<'a, 'b>, /* Important comment1-1
+      Important comment1-2 */
+        a: i32, /* Important comment2 */
+        b: i32, /* Important comment3 */
+    ) {
+    }
+
+    fn no_first_line_comment(
+        self: X<'a, 'b>,
+        /* Important comment2 */a: i32,
+        /* Important comment3 */b: i32,
+    ) {
+    }
 }