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