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