Comments.

- Move the option
- Add some more tests (don't pass yet)
This commit is contained in:
Pavel Sountsov 2015-11-16 23:18:07 -08:00 committed by SiegeLord
parent 8658774ad2
commit a96a69b708
7 changed files with 129 additions and 35 deletions

View File

@ -266,6 +266,7 @@ create_config! {
"Maximum width in the body of a struct lit before falling back to vertical formatting";
newline_style: NewlineStyle, NewlineStyle::Unix, "Unix or Windows line endings";
fn_brace_style: BraceStyle, BraceStyle::SameLineWhere, "Brace style for functions";
item_brace_style: BraceStyle, BraceStyle::SameLineWhere, "Brace style for structs and enums";
fn_return_indent: ReturnIndent, ReturnIndent::WithArgs,
"Location of return type in function declaration";
fn_args_paren_newline: bool, true, "If function argument parenthesis goes on a newline";
@ -302,5 +303,4 @@ create_config! {
take_source_hints: bool, true, "Retain some formatting characteristics from the source code";
hard_tabs: bool, false, "Use tab characters for indentation, spaces for alignment";
wrap_comments: bool, false, "Break comments to fit on the line";
item_brace_style: BraceStyle, BraceStyle::SameLineWhere, "Brace style for structs and enums";
}

View File

@ -0,0 +1,29 @@
// rustfmt-item_brace_style: AlwaysNextLine
mod M {
enum A {
A,
}
struct B {
b: i32,
}
// For empty enums and structs, the brace remains on the same line.
enum C {}
struct D {}
enum A<T> where T: Copy {
A,
}
struct B<T> where T: Copy {
b: i32,
}
// For empty enums and structs, the brace remains on the same line.
enum C<T> where T: Copy {}
struct D<T> where T: Copy {}
}

View File

@ -0,0 +1,29 @@
// rustfmt-item_brace_style: PreferSameLine
mod M {
enum A
{
A,
}
struct B
{
b: i32,
}
enum C {}
struct D {}
enum A<T> where T: Copy {
A,
}
struct B<T> where T: Copy {
b: i32,
}
enum C<T> where T: Copy {}
struct D<T> where T: Copy {}
}

View File

@ -1,16 +0,0 @@
// rustfmt-item_brace_style: AlwaysNextLine
mod M {
enum A {
A,
}
struct B {
b: i32,
}
// For empty enums and structs, the brace remains on the same line.
enum C {}
struct D {}
}

View File

@ -0,0 +1,39 @@
// rustfmt-item_brace_style: AlwaysNextLine
mod M {
enum A
{
A,
}
struct B
{
b: i32,
}
// For empty enums and structs, the brace remains on the same line.
enum C {}
struct D {}
enum A<T>
where T: Copy
{
A,
}
struct B<T>
where T: Copy
{
b: i32,
}
// For empty enums and structs, the brace remains on the same line.
enum C<T>
where T: Copy
{}
struct D<T>
where T: Copy
{}
}

View File

@ -0,0 +1,31 @@
// rustfmt-item_brace_style: PreferSameLine
mod M {
enum A {
A,
}
struct B {
b: i32,
}
enum C {}
struct D {}
enum A<T>
where T: Copy {
A,
}
struct B<T>
where T: Copy {
b: i32,
}
enum C<T>
where T: Copy {}
struct D<T>
where T: Copy {}
}

View File

@ -1,18 +0,0 @@
// rustfmt-item_brace_style: AlwaysNextLine
mod M {
enum A
{
A,
}
struct B
{
b: i32,
}
// For empty enums and structs, the brace remains on the same line.
enum C {}
struct D {}
}