]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/target/trailing_commas.rs
:arrow_up: rust-analyzer
[rust.git] / src / tools / rustfmt / tests / target / trailing_commas.rs
1 // rustfmt-match_block_trailing_comma: true
2 // rustfmt-trailing_comma: Always
3
4 fn main() {
5     match foo {
6         x => {},
7         y => {
8             foo();
9         },
10         _ => x,
11     }
12 }
13
14 fn f<S, T,>(x: T, y: S,) -> T
15 where
16     T: P,
17     S: Q,
18 {
19     x
20 }
21
22 impl Trait for T
23 where
24     T: P,
25 {
26     fn f(x: T,) -> T
27     where
28         T: Q + R,
29     {
30         x
31     }
32 }
33
34 struct Pair<S, T,>
35 where
36     T: P,
37     S: P + Q,
38 {
39     a: T,
40     b: S,
41 }
42
43 struct TupPair<S, T,>(S, T,)
44 where
45     T: P,
46     S: P + Q;
47
48 enum E<S, T,>
49 where
50     S: P,
51     T: P,
52 {
53     A { a: T, },
54 }
55
56 type Double<T,>
57 where
58     T: P,
59     T: Q,
60 = Pair<T, T,>;
61
62 extern "C" {
63     fn f<S, T,>(x: T, y: S,) -> T
64     where
65         T: P,
66         S: Q;
67 }
68
69 trait Q<S, T,>
70 where
71     T: P,
72     S: R,
73 {
74     fn f<U, V,>(self, x: T, y: S, z: U,) -> Self
75     where
76         U: P,
77         V: P;
78 }