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