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