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