]> git.lizzy.rs Git - rust.git/blob - tests/source/trailing_commas.rs
Prevent duplicate comma when formatting struct pattern with ".."
[rust.git] / tests / source / 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 where T: P, S: Q
15 {
16     x
17 }
18
19 impl Trait for T where T: P
20 {
21     fn f(x: T) -> T where T: Q + R
22     {
23         x
24     }
25 }
26
27 struct Pair<S, T> where T: P, S: P + Q {
28     a: T,
29     b: S
30 }
31
32 struct TupPair<S, T> (S, T) where T: P, S: P + Q;
33
34 enum E<S, T> where S: P, T: P {
35     A {a: T},
36 }
37
38 type Double<T> where T: P, T: Q = Pair<T, T>;
39
40 extern "C" {
41     fn f<S, T>(x: T, y: S) -> T where T: P, S: Q;
42 }
43
44 trait Q<S, T> where T: P, S: R
45 {
46     fn f<U, V>(self, x: T, y: S, z: U) -> Self where U: P, V: P;
47 }