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