mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-12 20:16:49 +00:00
Comments.
- Move the option - Add some more tests (don't pass yet)
This commit is contained in:
parent
8658774ad2
commit
a96a69b708
@ -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";
|
||||
}
|
||||
|
29
tests/source/item-brace-style-next-line.rs
Normal file
29
tests/source/item-brace-style-next-line.rs
Normal 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 {}
|
||||
}
|
29
tests/source/item-brace-style-same-line.rs
Normal file
29
tests/source/item-brace-style-same-line.rs
Normal 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 {}
|
||||
}
|
@ -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 {}
|
||||
}
|
39
tests/target/item-brace-style-next-line.rs
Normal file
39
tests/target/item-brace-style-next-line.rs
Normal 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
|
||||
{}
|
||||
}
|
31
tests/target/item-brace-style-same-line.rs
Normal file
31
tests/target/item-brace-style-same-line.rs
Normal 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 {}
|
||||
}
|
@ -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 {}
|
||||
}
|
Loading…
Reference in New Issue
Block a user