summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/tests/target/fn-single-line/version_two.rs
blob: b8053d4c2f500a37cf1e5cf70abb54248e530e64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// rustfmt-fn_single_line: true
// rustfmt-version: Two
// Test single-line functions.

fn foo_expr() { 1 }

fn foo_stmt() { foo(); }

fn foo_decl_local() { let z = 5; }

fn foo_decl_item(x: &mut i32) { x = 3; }

fn empty() {}

fn foo_return() -> String { "yay" }

fn foo_where() -> T
where
    T: Sync,
{
    let x = 2;
}

fn fooblock() { { "inner-block" } }

fn fooblock2(x: i32) {
    let z = match x {
        _ => 2,
    };
}

fn comment() {
    // this is a test comment
    1
}

fn comment2() {
    // multi-line comment
    let z = 2;
    1
}

fn only_comment() {
    // Keep this here
}

fn aaaaaaaaaaaaaaaaa_looooooooooooooooooooooong_name() {
    let z = "aaaaaaawwwwwwwwwwwwwwwwwwwwwwwwwwww";
}

fn lots_of_space() { 1 }

fn mac() -> Vec<i32> { vec![] }

trait CoolTypes {
    fn dummy(&self) {}
}

trait CoolerTypes {
    fn dummy(&self) {}
}

fn Foo<T>()
where
    T: Bar,
{
}