]> git.lizzy.rs Git - rust.git/blob - tests/target/hard-tabs.rs
Reformat tests
[rust.git] / tests / target / hard-tabs.rs
1 // rustfmt-normalize_comments: true
2 // rustfmt-single_line_if_else_max_width: 0
3 // rustfmt-wrap_comments: true
4 // rustfmt-hard_tabs: true
5 // rustfmt-error_on_line_overflow: false
6
7 fn main() {
8         let x = Bar;
9
10         let y = Foo { a: x };
11
12         Foo {
13                 a: foo(), // comment
14                 // comment
15                 b: bar(),
16                 ..something
17         };
18
19         fn foo(a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32) {
20         }
21
22         let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAa";
23
24         if let (some_very_large,
25              tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) = 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(// First arg
61                       A,
62                       // Second argument
63                       B,
64                       C,
65                       D,
66                       // pre comment
67                       E /* last comment */)
68                       -> &SomeType,
69         {
70                 arg(a, b, c, d, e)
71         }
72
73         loong_func().quux(move || if true {
74                 1
75         } else {
76                 2
77         });
78
79         fffffffffffffffffffffffffffffffffff(a, {
80                 SCRIPT_TASK_ROOT.with(|root| { *root.borrow_mut() = Some(&script_task); });
81         });
82         a.b.c.d();
83
84         x().y(|| match cond() {
85                 true => (),
86                 false => (),
87         });
88 }