]> git.lizzy.rs Git - rust.git/blob - tests/target/struct_lits_visual.rs
Don't be so aggressie about line-breaking strings (#911)
[rust.git] / tests / target / struct_lits_visual.rs
1 // rustfmt-wrap_comments: true
2 // rustfmt-struct_lit_style: Visual
3
4 // Struct literal expressions.
5
6 fn main() {
7     let x = Bar;
8
9     // Comment
10     let y = Foo { a: x };
11
12     Foo { a: foo(), // comment
13           // comment
14           b: bar(),
15           ..something };
16
17     Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo { a: f(), b: b() };
18
19     Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo { // Comment
20                                                                                         a: foo(), /* Comment */
21                                                                                         // Comment
22                                                                                         b: bar(), /* Comment */ };
23
24     Foo { a: Bar, b: f() };
25
26     Quux { x: if cond {
27                bar();
28            },
29            y: baz(), };
30
31     Baz { x: yxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
32           z: zzzzz, /* test */ };
33
34     A { // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit
35         // amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante
36         // hendrerit. Donec et mollis dolor.
37         first: item(),
38         // Praesent et diam eget libero egestas mattis sit amet vitae augue.
39         // Nam tincidunt congue enim, ut porta lorem lacinia consectetur.
40         second: Item, };
41
42     Diagram { //                 o        This graph demonstrates how
43               //                / \       significant whitespace is
44               //               o   o      preserved.
45               //              /|\   \
46               //             o o o   o
47               graph: G, }
48 }