]> git.lizzy.rs Git - rust.git/blob - tests/target/hard-tabs.rs
Make tests fail if rustfmt encounters an error
[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,
20                a: i32,
21                a: i32,
22                a: i32,
23                a: i32,
24                a: i32,
25                a: i32,
26                a: i32,
27                a: i32,
28                a: i32,
29                a: i32) {
30         }
31
32         let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAa";
33
34         if let (some_very_large,
35                 tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) = 1 + 2 + 3 {}
36
37         if cond() {
38                 something();
39         } else if different_cond() {
40                 something_else();
41         } else {
42                 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
43                 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
44         }
45
46         unsafe /* very looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
47                 * comment */ {
48         }
49
50         unsafe /* So this is a very long comment.
51                 * Multi-line, too.
52                 * Will it still format correctly? */ {
53         }
54
55         let chain = funktion_kall()
56                 .go_to_next_line_with_tab()
57                 .go_to_next_line_with_tab()
58                 .go_to_next_line_with_tab();
59
60         let z =
61                 [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz, 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 */)
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| { *root.borrow_mut() = Some(&script_task); });
85         });
86         a.b
87                 .c
88                 .d();
89
90         x().y(|| match cond() {
91                 true => (),
92                 false => (),
93         });
94 }