]> git.lizzy.rs Git - rust.git/blob - tests/target/struct_lits.rs
Merge pull request #207 from cassiersg/find-comments
[rust.git] / tests / target / struct_lits.rs
1 // Struct literal expressions.
2
3 fn main() {
4     let x = Bar;
5
6     // Comment
7     let y = Foo { a: x };
8
9     Foo {
10         a: foo(), // comment
11         // comment
12         b: bar(),
13         ..something
14     };
15
16     Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo { a: foo(), b: bar() };
17
18     Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo {
19         a: foo(),
20         b: bar(),
21     };
22
23     Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo {
24         // Comment
25         a: foo(), // Comment
26         // Comment
27         b: bar(), /* Comment */
28     };
29
30     Foo { a: Bar, b: foo() };
31
32     Quux {
33         x: if cond {
34             bar();
35         },
36         y: baz(),
37     };
38
39     A {
40         // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit
41         // amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante
42         // hendrerit. Donec et mollis dolor.
43         first: item(),
44         // Praesent et diam eget libero egestas mattis sit amet vitae augue.
45         // Nam tincidunt congue enim, ut porta lorem lacinia consectetur.
46         second: Item,
47     };
48
49     Diagram {
50         //                 o        This graph demonstrates how
51         //                / \       significant whitespace is
52         //               o   o      preserved.
53         //              /|\   \
54         //             o o o   o
55         graph: G,
56     }
57 }
58
59 fn matcher() {
60     TagTerminatedByteMatcher {
61         matcher: ByteMatcher {
62             pattern: b"<HTML",
63             mask: b"\xFF\xDF\xDF\xDF\xDF\xFF",
64         },
65     };
66 }
67
68 fn issue177() {
69     struct Foo<T> {
70         memb: T,
71     }
72     let foo = Foo::<i64> { memb: 10 };
73 }
74
75 fn issue201() {
76     let s = S { a: 0, ..b };
77 }
78
79 fn issue201_2() {
80     let s = S { a: S2 { ..c }, ..b };
81 }