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