Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
By default, places functions with empty bodies on one line. If the function has only one expression or statement that fits on one line, the 'fn_single_line' option can be used.
- Loading branch information
Showing
17 changed files
with
298 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// 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; | ||
} | ||
|
||
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 | ||
} | ||
|
||
trait CoolTypes { | ||
fn dummy(&self) { | ||
} | ||
} | ||
|
||
trait CoolerTypes { fn dummy(&self) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,8 +32,7 @@ fn test() { | |
} | ||
|
||
/// test123 | ||
fn doc_comment() { | ||
} | ||
fn doc_comment() { } | ||
|
||
fn chains() { | ||
foo.bar(|| { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.