]> git.lizzy.rs Git - rust.git/blob - tests/target/structs.rs
Merge pull request #200 from sinhpham/master
[rust.git] / tests / target / structs.rs
1
2 /// A Doc comment
3 #[AnAttribute]
4 pub struct Foo {
5     #[rustfmt_skip]
6     f :   SomeType, // Comment beside a field
7     f: SomeType, // Comment beside a field
8     // Comment on a field
9     #[AnAttribute]
10     g: SomeOtherType,
11     /// A doc comment on a field
12     h: AThirdType,
13     pub i: TypeForPublicField,
14 }
15
16 struct Bar;
17
18 struct NewType(Type, OtherType);
19
20 struct NewInt<T: Copy>(pub i32, SomeType /* inline comment */, T /* sup */);
21
22 struct Qux<'a,
23            N: Clone + 'a,
24            E: Clone + 'a,
25            G: Labeller<'a, N, E> + GraphWalk<'a, N, E>,
26            W: Write + Copy>
27 (
28     AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, // Comment
29     BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
30     #[AnAttr]
31     // Comment
32     /// Testdoc
33     G,
34     pub W,
35 );
36
37 struct Tuple(
38     // Comment 1
39     AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
40     // Comment 2
41     BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
42 );
43
44 // With a where clause and generics.
45 pub struct Foo<'a, Y: Baz>
46     where X: Whatever
47 {
48     f: SomeType, // Comment beside a field
49 }
50
51 struct Baz {
52     a: A, // Comment A
53     b: B, // Comment B
54     c: C, // Comment C
55 }
56
57 struct Baz {
58     // Comment A
59     a: A,
60     // Comment B
61     b: B,
62     // Comment C
63     c: C,
64 }
65
66 // Will this be a one-liner?
67 struct Tuple(A /* Comment */, B);
68
69 pub struct State<F: FnMut() -> time::Timespec> {
70     now: F,
71 }
72
73 pub struct State<F: FnMut() -> ()> {
74     now: F,
75 }
76
77 pub struct State<F: FnMut()> {
78     now: F,
79 }