@@ -15,7 +15,7 @@ use crate::comment::{
15
15
FindUncommented ,
16
16
} ;
17
17
use crate :: config:: lists:: * ;
18
- use crate :: config:: { BraceStyle , Config , Density , IndentStyle , Version } ;
18
+ use crate :: config:: { BraceStyle , Config , IndentStyle , Version } ;
19
19
use crate :: expr:: {
20
20
format_expr, is_empty_block, is_simple_block_stmt, rewrite_assign_rhs, rewrite_assign_rhs_with,
21
21
ExprType , RhsTactics ,
@@ -703,7 +703,7 @@ pub(crate) fn format_impl(
703
703
& generics. where_clause ,
704
704
context. config . brace_style ( ) ,
705
705
Shape :: legacy ( where_budget, offset. block_only ( ) ) ,
706
- Density :: Vertical ,
706
+ false ,
707
707
"{" ,
708
708
where_span_end,
709
709
self_ty. span . hi ( ) ,
@@ -1045,11 +1045,7 @@ pub(crate) fn format_trait(
1045
1045
1046
1046
// Rewrite where-clause.
1047
1047
if !generics. where_clause . predicates . is_empty ( ) {
1048
- let where_density = if context. config . indent_style ( ) == IndentStyle :: Block {
1049
- Density :: Compressed
1050
- } else {
1051
- Density :: Tall
1052
- } ;
1048
+ let where_on_new_line = context. config . indent_style ( ) != IndentStyle :: Block ;
1053
1049
1054
1050
let where_budget = context. budget ( last_line_width ( & result) ) ;
1055
1051
let pos_before_where = if generic_bounds. is_empty ( ) {
@@ -1063,7 +1059,7 @@ pub(crate) fn format_trait(
1063
1059
& generics. where_clause ,
1064
1060
context. config . brace_style ( ) ,
1065
1061
Shape :: legacy ( where_budget, offset. block_only ( ) ) ,
1066
- where_density ,
1062
+ where_on_new_line ,
1067
1063
"{" ,
1068
1064
None ,
1069
1065
pos_before_where,
@@ -1382,7 +1378,7 @@ fn format_tuple_struct(
1382
1378
& generics. where_clause ,
1383
1379
context. config . brace_style ( ) ,
1384
1380
Shape :: legacy ( where_budget, offset. block_only ( ) ) ,
1385
- Density :: Compressed ,
1381
+ false ,
1386
1382
";" ,
1387
1383
None ,
1388
1384
body_hi,
@@ -1459,7 +1455,7 @@ fn rewrite_type_prefix(
1459
1455
& generics. where_clause ,
1460
1456
context. config . brace_style ( ) ,
1461
1457
Shape :: legacy ( where_budget, indent) ,
1462
- Density :: Vertical ,
1458
+ false ,
1463
1459
"=" ,
1464
1460
None ,
1465
1461
generics. span . hi ( ) ,
@@ -2211,7 +2207,7 @@ fn rewrite_fn_base(
2211
2207
where_clause,
2212
2208
context. config . brace_style ( ) ,
2213
2209
Shape :: indented ( indent, context. config ) ,
2214
- Density :: Tall ,
2210
+ true ,
2215
2211
"{" ,
2216
2212
Some ( span. hi ( ) ) ,
2217
2213
pos_before_where,
@@ -2564,7 +2560,7 @@ fn rewrite_where_clause(
2564
2560
where_clause : & ast:: WhereClause ,
2565
2561
brace_style : BraceStyle ,
2566
2562
shape : Shape ,
2567
- density : Density ,
2563
+ on_new_line : bool ,
2568
2564
terminator : & str ,
2569
2565
span_end : Option < BytePos > ,
2570
2566
span_end_before_where : BytePos ,
@@ -2646,7 +2642,7 @@ fn rewrite_where_clause(
2646
2642
} else {
2647
2643
terminator. len ( )
2648
2644
} ;
2649
- if density == Density :: Tall
2645
+ if on_new_line
2650
2646
|| preds_str. contains ( '\n' )
2651
2647
|| shape. indent . width ( ) + " where " . len ( ) + preds_str. len ( ) + end_length > shape. width
2652
2648
{
@@ -2737,7 +2733,7 @@ fn format_generics(
2737
2733
& generics. where_clause ,
2738
2734
brace_style,
2739
2735
Shape :: legacy ( budget, offset. block_only ( ) ) ,
2740
- Density :: Tall ,
2736
+ true ,
2741
2737
"{" ,
2742
2738
Some ( span. hi ( ) ) ,
2743
2739
span_end_before_where,
0 commit comments