]> git.lizzy.rs Git - rust.git/blob - tests/target/struct_lits.rs
Fix tests
[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     Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo { a: f(), b: b() };
17
18     Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo {
19         a: f(),
20         b: b(),
21     };
22
23     Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo {
24         // Comment
25         a: foo(), // Comment
26         // Comment
27         b: bar(), /* Comment */
28     };
29
30     Foo { a: Bar, b: f() };
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     Some(Data::MethodCallData(MethodCallData {
50         span: sub_span.unwrap(),
51         scope: self.enclosing_scope(id),
52         ref_id: def_id,
53         decl_id: Some(decl_id),
54     }));
55
56     Diagram {
57         //                 o        This graph demonstrates how
58         //                / \       significant whitespace is
59         //               o   o      preserved.
60         //              /|\   \
61         //             o o o   o
62         graph: G,
63     }
64 }
65
66 fn matcher() {
67     TagTerminatedByteMatcher {
68         matcher: ByteMatcher {
69             pattern: b"<HTML",
70             mask: b"\xFF\xDF\xDF\xDF\xDF\xFF",
71         },
72     };
73 }
74
75 fn issue177() {
76     struct Foo<T> {
77         memb: T,
78     }
79     let foo = Foo::<i64> { memb: 10 };
80 }
81
82 fn issue201() {
83     let s = S { a: 0, ..b };
84 }
85
86 fn issue201_2() {
87     let s = S { a: S2 { ..c }, ..b };
88 }
89
90 fn issue278() {
91     let s = S {
92         a: 0,
93         //
94         b: 0,
95     };
96     let s1 = S {
97         a: 0,
98         // foo
99         //
100         // bar
101         b: 0,
102     };
103 }
104
105 fn struct_exprs() {
106     Foo { a: 1, b: f(2) };
107     Foo {
108         a: 1,
109         b: f(2),
110         ..g(3)
111     };
112     LoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongStruct {
113         ..base
114     };
115     IntrinsicISizesContribution {
116         content_intrinsic_sizes: IntrinsicISizes { minimum_inline_size: 0 },
117     };
118 }
119
120 fn issue123() {
121     Foo { a: b, c: d, e: f };
122
123     Foo {
124         a: bb,
125         c: dd,
126         e: ff,
127     };
128
129     Foo {
130         a: ddddddddddddddddddddd,
131         b: cccccccccccccccccccccccccccccccccccccc,
132     };
133 }