]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/source/hard-tabs.rs
Rollup merge of #107166 - petrochenkov:nooptable, r=oli-obk
[rust.git] / src / tools / rustfmt / tests / source / hard-tabs.rs
1 // rustfmt-normalize_comments: true
2 // rustfmt-wrap_comments: true
3 // rustfmt-hard_tabs: true
4
5 fn main() {
6 let x = Bar;
7
8 let y = Foo {a: x };
9
10 Foo { a: foo() /* comment*/, /* comment*/ b: bar(), ..something };
11
12 fn foo(a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32, a: i32) {}
13
14 let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAa";
15
16 if let (some_very_large, tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) = 1
17 + 2 + 3 {
18 }
19
20     if cond() {
21         something();
22     } else  if different_cond() {
23         something_else();
24     } else {
25         aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
26     }
27     
28 unsafe /* very looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong comment */ {}
29
30 unsafe // So this is a very long comment.
31    // Multi-line, too.
32    // Will it still format correctly?
33 {
34 }
35
36 let chain = funktion_kall().go_to_next_line_with_tab().go_to_next_line_with_tab().go_to_next_line_with_tab();
37
38 let z = [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz, q];
39
40 fn generic<T>(arg: T) -> &SomeType
41     where T: Fn(// First arg
42         A,
43         // Second argument
44         B, C, D, /* pre comment */ E /* last comment */) -> &SomeType {
45     arg(a, b, c, d, e)    
46 }
47
48     loong_func().quux(move || {
49         if true {
50             1
51         } else {
52             2
53         }
54     });
55
56     fffffffffffffffffffffffffffffffffff(a,
57                                         {
58                                             SCRIPT_TASK_ROOT
59                                             .with(|root| {
60                                                 *root.borrow_mut()  =   Some(&script_task);
61                                             });
62                                         });
63     a.b
64      .c
65      .d();
66     
67     x().y(|| {
68         match cond() {
69             true => (),
70             false => (),
71         }
72     });
73 }
74
75 // #2296
76 impl Foo {
77         // a comment
78         // on multiple lines
79         fn foo() {
80                 // another comment
81                 // on multiple lines
82                 let x = true;
83         }
84 }