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