2015-11-18 05:53:06 +01:00
|
|
|
// rustfmt-fn_single_line: true
|
|
|
|
// 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; }
|
|
|
|
|
2015-11-20 03:11:32 +01:00
|
|
|
fn empty() {}
|
2015-11-18 05:53:06 +01:00
|
|
|
|
|
|
|
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 }
|
|
|
|
|
2015-11-19 09:08:17 +01:00
|
|
|
fn mac() -> Vec<i32> { vec![] }
|
|
|
|
|
2015-11-18 05:53:06 +01:00
|
|
|
trait CoolTypes {
|
2015-11-20 03:11:32 +01:00
|
|
|
fn dummy(&self) {}
|
2015-11-18 05:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
trait CoolerTypes {
|
2015-11-20 03:11:32 +01:00
|
|
|
fn dummy(&self) {}
|
2015-11-18 05:53:06 +01:00
|
|
|
}
|
2016-01-11 06:06:06 +01:00
|
|
|
|
|
|
|
fn Foo<T>() where T: Bar {}
|