@@ -314,7 +314,7 @@ impl<'a> FmtVisitor<'a> {
314
314
rewrite_fn_base ( & context, indent, ident, fn_sig, span, newline_brace, true ) ?;
315
315
316
316
// 2 = ` {`
317
- if self . config . fn_brace_style ( ) == BraceStyle :: AlwaysNextLine || force_newline_brace
317
+ if self . config . brace_style ( ) == BraceStyle :: AlwaysNextLine || force_newline_brace
318
318
|| last_line_width ( & result) + 2 > self . shape ( ) . width
319
319
{
320
320
newline_brace = true ;
@@ -440,7 +440,7 @@ impl<'a> FmtVisitor<'a> {
440
440
let generics_str = format_generics (
441
441
& self . get_context ( ) ,
442
442
generics,
443
- self . config . item_brace_style ( ) ,
443
+ self . config . brace_style ( ) ,
444
444
if enum_def. variants . is_empty ( ) {
445
445
BracePos :: ForceSameLine
446
446
} else {
@@ -595,7 +595,7 @@ pub fn format_impl(
595
595
let where_clause_str = rewrite_where_clause (
596
596
context,
597
597
& generics. where_clause ,
598
- context. config . item_brace_style ( ) ,
598
+ context. config . brace_style ( ) ,
599
599
Shape :: legacy ( where_budget, offset. block_only ( ) ) ,
600
600
context. config . where_density ( ) ,
601
601
"{" ,
@@ -641,7 +641,7 @@ pub fn format_impl(
641
641
}
642
642
result. push_str ( & where_clause_str) ;
643
643
644
- match context. config . item_brace_style ( ) {
644
+ match context. config . brace_style ( ) {
645
645
_ if last_line_contains_single_line_comment ( & result) => result. push_str ( & sep) ,
646
646
BraceStyle :: AlwaysNextLine => result. push_str ( & sep) ,
647
647
BraceStyle :: PreferSameLine => result. push ( ' ' ) ,
@@ -784,7 +784,7 @@ fn format_impl_ref_and_type(
784
784
let curly_brace_overhead = if generics. where_clause . predicates . is_empty ( ) {
785
785
// If there is no where clause adapt budget for type formatting to take space and curly
786
786
// brace into account.
787
- match context. config . item_brace_style ( ) {
787
+ match context. config . brace_style ( ) {
788
788
BraceStyle :: AlwaysNextLine => 0 ,
789
789
_ => 2 ,
790
790
}
@@ -994,7 +994,7 @@ pub fn format_trait(context: &RewriteContext, item: &ast::Item, offset: Indent)
994
994
let where_clause_str = rewrite_where_clause (
995
995
context,
996
996
& generics. where_clause ,
997
- context. config . item_brace_style ( ) ,
997
+ context. config . brace_style ( ) ,
998
998
Shape :: legacy ( where_budget, offset. block_only ( ) ) ,
999
999
where_density,
1000
1000
"{" ,
@@ -1038,7 +1038,7 @@ pub fn format_trait(context: &RewriteContext, item: &ast::Item, offset: Indent)
1038
1038
}
1039
1039
}
1040
1040
1041
- match context. config . item_brace_style ( ) {
1041
+ match context. config . brace_style ( ) {
1042
1042
_ if last_line_contains_single_line_comment ( & result) => {
1043
1043
result. push ( '\n' ) ;
1044
1044
result. push_str ( & offset. to_string ( context. config ) ) ;
@@ -1103,7 +1103,7 @@ fn format_unit_struct(context: &RewriteContext, p: &StructParts, offset: Indent)
1103
1103
format_generics (
1104
1104
context,
1105
1105
generics,
1106
- context. config . item_brace_style ( ) ,
1106
+ context. config . brace_style ( ) ,
1107
1107
BracePos :: None ,
1108
1108
offset,
1109
1109
mk_sp ( generics. span . lo ( ) , hi) ,
@@ -1135,7 +1135,7 @@ pub fn format_struct_struct(
1135
1135
Some ( g) => format_generics (
1136
1136
context,
1137
1137
g,
1138
- context. config . item_brace_style ( ) ,
1138
+ context. config . brace_style ( ) ,
1139
1139
if fields. is_empty ( ) {
1140
1140
BracePos :: ForceSameLine
1141
1141
} else {
@@ -1148,8 +1148,7 @@ pub fn format_struct_struct(
1148
1148
None => {
1149
1149
// 3 = ` {}`, 2 = ` {`.
1150
1150
let overhead = if fields. is_empty ( ) { 3 } else { 2 } ;
1151
- if ( context. config . item_brace_style ( ) == BraceStyle :: AlwaysNextLine
1152
- && !fields. is_empty ( ) )
1151
+ if ( context. config . brace_style ( ) == BraceStyle :: AlwaysNextLine && !fields. is_empty ( ) )
1153
1152
|| context. config . max_width ( ) < overhead + result. len ( )
1154
1153
{
1155
1154
format ! ( "\n {}{{" , offset. block_only( ) . to_string( context. config) )
@@ -1279,7 +1278,7 @@ fn format_tuple_struct(
1279
1278
rewrite_where_clause (
1280
1279
context,
1281
1280
& generics. where_clause ,
1282
- context. config . item_brace_style ( ) ,
1281
+ context. config . brace_style ( ) ,
1283
1282
Shape :: legacy ( where_budget, offset. block_only ( ) ) ,
1284
1283
Density :: Compressed ,
1285
1284
";" ,
@@ -1365,7 +1364,7 @@ pub fn rewrite_type_alias(
1365
1364
let where_clause_str = rewrite_where_clause (
1366
1365
context,
1367
1366
& generics. where_clause ,
1368
- context. config . item_brace_style ( ) ,
1367
+ context. config . brace_style ( ) ,
1369
1368
Shape :: legacy ( where_budget, indent) ,
1370
1369
context. config . where_density ( ) ,
1371
1370
"=" ,
@@ -2071,7 +2070,7 @@ fn rewrite_fn_base(
2071
2070
if let Some ( where_clause_str) = rewrite_where_clause (
2072
2071
context,
2073
2072
where_clause,
2074
- context. config . fn_brace_style ( ) ,
2073
+ context. config . brace_style ( ) ,
2075
2074
Shape :: legacy ( budget, indent) ,
2076
2075
Density :: Compressed ,
2077
2076
"{" ,
@@ -2090,7 +2089,7 @@ fn rewrite_fn_base(
2090
2089
let where_clause_str = rewrite_where_clause (
2091
2090
context,
2092
2091
where_clause,
2093
- context. config . fn_brace_style ( ) ,
2092
+ context. config . brace_style ( ) ,
2094
2093
Shape :: indented ( indent, context. config ) ,
2095
2094
Density :: Tall ,
2096
2095
"{" ,
@@ -2386,7 +2385,7 @@ fn newline_for_brace(config: &Config, where_clause: &ast::WhereClause, has_body:
2386
2385
if config. where_single_line ( ) && predicate_count == 1 {
2387
2386
return false ;
2388
2387
}
2389
- match ( config. fn_brace_style ( ) , config. where_density ( ) ) {
2388
+ match ( config. brace_style ( ) , config. where_density ( ) ) {
2390
2389
( BraceStyle :: AlwaysNextLine , _) => true ,
2391
2390
( _, Density :: Compressed ) if predicate_count == 1 => false ,
2392
2391
( _, Density :: CompressedIfEmpty ) if predicate_count == 1 && !has_body => false ,
0 commit comments