]> git.lizzy.rs Git - rust.git/blob - rustfmt-core/tests/source/macro_rules.rs
02c9717e11e047ce8c638c0456d076866911a4fd
[rust.git] / rustfmt-core / tests / source / macro_rules.rs
1 macro_rules! m {
2         // a
3         ($expr :expr,  $( $func : ident    ) *   ) => {
4                 {
5                 let    x =    $expr;
6                                                                                         $func (
7                                                                                                                 x
8                                                                                         )
9         }
10         };
11
12                                 /* b */
13
14         ()           => {/* c */};
15
16                                                 (@tag)   =>
17                                                  {
18
19                                                  };
20
21 // d
22 ( $item:ident  ) =>      {
23         mod macro_item    {  struct $item ; }
24 };
25 }
26
27 macro m2 {
28         // a
29         ($expr :expr,  $( $func : ident    ) *   ) => {
30                 {
31                 let    x =    $expr;
32                                                                                         $func (
33                                                                                                                 x
34                                                                                         )
35         }
36         }
37
38                                 /* b */
39
40         ()           => {/* c */}
41
42                                                 (@tag)   =>
43                                                  {
44
45                                                  }
46
47 // d
48 ( $item:ident  ) =>      {
49         mod macro_item    {  struct $item ; }
50 }
51 }
52
53
54 // #2438
55 macro_rules! m {
56     () => {
57         this_line_is_99_characters_long_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
58         ); // this line is drifting
59     };
60 }
61
62 // #2439
63 macro_rules! m {
64     (
65         $line0_xxxxxxxxxxxxxxxxx: expr,
66         $line1_xxxxxxxxxxxxxxxxx: expr,
67         $line2_xxxxxxxxxxxxxxxxx: expr,
68         $line3_xxxxxxxxxxxxxxxxx: expr,
69     ) => {};
70 }