]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/source/fn-single-line/version_two.rs
Add 'src/tools/rustfmt/' from commit '7872306edf2e11a69aaffb9434088fd66b46a863'
[rust.git] / src / tools / rustfmt / tests / source / fn-single-line / version_two.rs
1 // rustfmt-fn_single_line: true
2 // rustfmt-version: Two
3 // Test single-line functions.
4
5 fn foo_expr() {
6     1
7 }
8
9 fn foo_stmt() {
10     foo();
11 }
12
13 fn foo_decl_local()  {
14     let z = 5;
15    }
16
17 fn    foo_decl_item(x: &mut i32) {
18     x = 3;
19 }
20
21    fn empty()     {
22
23 }
24
25 fn foo_return() -> String {
26     "yay"
27 }
28
29 fn foo_where() -> T where T: Sync {
30     let x = 2;
31 }
32
33 fn fooblock() {
34     {
35         "inner-block"
36     }
37 }
38
39 fn fooblock2(x: i32) {
40     let z = match x {
41         _ => 2,
42     };
43 }
44
45 fn comment() {
46     // this is a test comment
47     1
48 }
49
50 fn comment2() {
51     // multi-line comment
52     let z = 2;
53     1
54 }
55
56 fn only_comment() {
57     // Keep this here
58 }
59
60 fn aaaaaaaaaaaaaaaaa_looooooooooooooooooooooong_name() {
61     let z = "aaaaaaawwwwwwwwwwwwwwwwwwwwwwwwwwww";
62 }
63
64 fn lots_of_space                      ()                                                           {
65                            1                 
66 }
67
68 fn mac() -> Vec<i32> { vec![] }
69
70 trait CoolTypes {
71     fn dummy(&self) {
72     }
73 }
74
75 trait CoolerTypes { fn dummy(&self) { 
76 }
77 }
78
79 fn Foo<T>() where T: Bar {
80 }