]> git.lizzy.rs Git - rust.git/blob - tests/target/struct_lits_multiline.rs
Merge pull request #618 from zyphrus/master
[rust.git] / tests / target / struct_lits_multiline.rs
1 // rustfmt-wrap_comments: true
2 // rustfmt-struct_lit_multiline_style: ForceMulti
3
4 // Struct literal expressions.
5
6 fn main() {
7     let x = Bar;
8
9     // Comment
10     let y = Foo {
11         a: x,
12     };
13
14     Foo {
15         a: foo(), // comment
16         // comment
17         b: bar(),
18         ..something
19     };
20
21     Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo {
22         a: foo(),
23         b: bar(),
24     };
25
26     Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo {
27         a: foo(),
28         b: bar(),
29     };
30
31     Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo {
32         // Comment
33         a: foo(), // Comment
34         // Comment
35         b: bar(), // Comment
36     };
37
38     Foo {
39         a: Bar,
40         b: foo(),
41     };
42
43     Quux {
44         x: if cond {
45             bar();
46         },
47         y: baz(),
48     };
49
50     A {
51         // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit
52         // amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante
53         // hendrerit. Donec et mollis dolor.
54         first: item(),
55         // Praesent et diam eget libero egestas mattis sit amet vitae augue.
56         // Nam tincidunt congue enim, ut porta lorem lacinia consectetur.
57         second: Item,
58     };
59
60     Some(Data::MethodCallData(MethodCallData {
61         span: sub_span.unwrap(),
62         scope: self.enclosing_scope(id),
63         ref_id: def_id,
64         decl_id: Some(decl_id),
65     }));
66
67     Diagram {
68         //                 o        This graph demonstrates how
69         //                / \       significant whitespace is
70         //               o   o      preserved.
71         //              /|\   \
72         //             o o o   o
73         graph: G,
74     }
75 }
76
77 fn matcher() {
78     TagTerminatedByteMatcher {
79         matcher: ByteMatcher {
80             pattern: b"<HTML",
81             mask: b"\xFF\xDF\xDF\xDF\xDF\xFF",
82         },
83     };
84 }
85
86 fn issue177() {
87     struct Foo<T> {
88         memb: T,
89     }
90     let foo = Foo::<i64> {
91         memb: 10,
92     };
93 }
94
95 fn issue201() {
96     let s = S {
97         a: 0,
98         ..b
99     };
100 }
101
102 fn issue201_2() {
103     let s = S {
104         a: S2 {
105             ..c
106         },
107         ..b
108     };
109 }
110
111 fn issue491() {
112     Foo {
113         guard: None,
114         arm: 0, // Comment
115     };
116 }