]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | // rustfmt-normalize_comments: true |
2 | // rustfmt-wrap_comments: true | |
3 | // rustfmt-hard_tabs: true | |
4 | ||
5 | fn main() { | |
6 | let x = Bar; | |
7 | ||
8 | let y = Foo { a: x }; | |
9 | ||
10 | Foo { | |
11 | a: foo(), // comment | |
12 | // comment | |
13 | b: bar(), | |
14 | ..something | |
15 | }; | |
16 | ||
17 | fn foo(a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32) { | |
18 | } | |
19 | ||
20 | let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAa"; | |
21 | ||
22 | if let ( | |
23 | some_very_large, | |
24 | tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple, | |
25 | ) = 1 + 2 + 3 | |
26 | {} | |
27 | ||
28 | if cond() { | |
29 | something(); | |
30 | } else if different_cond() { | |
31 | something_else(); | |
32 | } else { | |
33 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | |
34 | + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | |
35 | } | |
36 | ||
37 | unsafe /* very looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong | |
38 | * comment */ { | |
39 | } | |
40 | ||
41 | unsafe /* So this is a very long comment. | |
42 | * Multi-line, too. | |
43 | * Will it still format correctly? */ { | |
44 | } | |
45 | ||
46 | let chain = funktion_kall() | |
47 | .go_to_next_line_with_tab() | |
48 | .go_to_next_line_with_tab() | |
49 | .go_to_next_line_with_tab(); | |
50 | ||
51 | let z = [ | |
52 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, | |
53 | yyyyyyyyyyyyyyyyyyyyyyyyyyy, | |
54 | zzzzzzzzzzzzzzzzzz, | |
55 | q, | |
56 | ]; | |
57 | ||
58 | fn generic<T>(arg: T) -> &SomeType | |
59 | where | |
60 | T: Fn( | |
61 | // First arg | |
62 | A, | |
63 | // Second argument | |
64 | B, | |
65 | C, | |
66 | D, | |
67 | // pre comment | |
68 | E, // last comment | |
69 | ) -> &SomeType, | |
70 | { | |
71 | arg(a, b, c, d, e) | |
72 | } | |
73 | ||
74 | loong_func().quux(move || if true { 1 } else { 2 }); | |
75 | ||
76 | fffffffffffffffffffffffffffffffffff(a, { | |
77 | SCRIPT_TASK_ROOT.with(|root| { | |
78 | *root.borrow_mut() = Some(&script_task); | |
79 | }); | |
80 | }); | |
81 | a.b.c.d(); | |
82 | ||
83 | x().y(|| match cond() { | |
84 | true => (), | |
85 | false => (), | |
86 | }); | |
87 | } | |
88 | ||
89 | // #2296 | |
90 | impl Foo { | |
91 | // a comment | |
92 | // on multiple lines | |
93 | fn foo() { | |
94 | // another comment | |
95 | // on multiple lines | |
96 | let x = true; | |
97 | } | |
98 | } |