]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/source/struct_lits_visual_multiline.rs
Rollup merge of #107166 - petrochenkov:nooptable, r=oli-obk
[rust.git] / src / tools / rustfmt / tests / source / struct_lits_visual_multiline.rs
1 // rustfmt-normalize_comments: true
2 // rustfmt-wrap_comments: true
3 // rustfmt-indent_style: Visual
4 // rustfmt-struct_lit_single_line: false
5
6 // Struct literal expressions.
7
8 fn main() {
9     let x = Bar;
10
11     // Comment
12     let y = Foo {a: x };
13
14     Foo { a: foo() /* comment*/, /* comment*/ b: bar(), ..something };
15
16     Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo { a: foo(), b: bar(), };
17
18     Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo {
19         // Comment
20         a: foo(), // Comment
21         // Comment
22         b: bar(), // Comment
23     };
24
25     Foo { a:Bar,
26           b:foo() };
27
28     Quux { x: if cond { bar(); }, y: baz() };
29
30     A {
31     // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor.
32     first: item(),
33         // Praesent et diam eget libero egestas mattis sit amet vitae augue.
34         // Nam tincidunt congue enim, ut porta lorem lacinia consectetur.
35         second: Item
36     };
37
38     Diagram { /*                 o        This graph demonstrates how
39                *                / \       significant whitespace is
40                *               o   o      preserved.
41                *              /|\   \
42                *             o o o   o */
43               graph: G, }
44 }