"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";
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";
}
--- /dev/null
+// 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 {}
+}
--- /dev/null
+// 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 {}
+}
--- /dev/null
+// 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
+ {}
+}