@@ -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 ( ) ,
@@ -1044,11 +1044,7 @@ pub(crate) fn format_trait(
1044
1044
1045
1045
// Rewrite where-clause.
1046
1046
if !generics. where_clause . predicates . is_empty ( ) {
1047
- let where_density = if context. config . indent_style ( ) == IndentStyle :: Block {
1048
- Density :: Compressed
1049
- } else {
1050
- Density :: Tall
1051
- } ;
1047
+ let where_on_new_line = context. config . indent_style ( ) != IndentStyle :: Block ;
1052
1048
1053
1049
let where_budget = context. budget ( last_line_width ( & result) ) ;
1054
1050
let pos_before_where = if generic_bounds. is_empty ( ) {
@@ -1062,7 +1058,7 @@ pub(crate) fn format_trait(
1062
1058
& generics. where_clause ,
1063
1059
context. config . brace_style ( ) ,
1064
1060
Shape :: legacy ( where_budget, offset. block_only ( ) ) ,
1065
- where_density ,
1061
+ where_on_new_line ,
1066
1062
"{" ,
1067
1063
None ,
1068
1064
pos_before_where,
@@ -1171,7 +1167,7 @@ impl<'a> Rewrite for TraitAliasBounds<'a> {
1171
1167
& self . generics . where_clause ,
1172
1168
context. config . brace_style ( ) ,
1173
1169
shape,
1174
- Density :: Compressed ,
1170
+ false ,
1175
1171
";" ,
1176
1172
None ,
1177
1173
self . generics . where_clause . span . lo ( ) ,
@@ -1423,7 +1419,7 @@ fn format_tuple_struct(
1423
1419
& generics. where_clause ,
1424
1420
context. config . brace_style ( ) ,
1425
1421
Shape :: legacy ( where_budget, offset. block_only ( ) ) ,
1426
- Density :: Compressed ,
1422
+ false ,
1427
1423
";" ,
1428
1424
None ,
1429
1425
body_hi,
@@ -1499,7 +1495,7 @@ fn rewrite_type_prefix(
1499
1495
& generics. where_clause ,
1500
1496
context. config . brace_style ( ) ,
1501
1497
Shape :: legacy ( where_budget, indent) ,
1502
- Density :: Vertical ,
1498
+ false ,
1503
1499
"=" ,
1504
1500
None ,
1505
1501
generics. span . hi ( ) ,
@@ -2258,7 +2254,7 @@ fn rewrite_fn_base(
2258
2254
where_clause,
2259
2255
context. config . brace_style ( ) ,
2260
2256
Shape :: indented ( indent, context. config ) ,
2261
- Density :: Tall ,
2257
+ true ,
2262
2258
"{" ,
2263
2259
Some ( span. hi ( ) ) ,
2264
2260
pos_before_where,
@@ -2390,7 +2386,7 @@ fn rewrite_args(
2390
2386
& arg_items,
2391
2387
context
2392
2388
. config
2393
- . fn_args_density ( )
2389
+ . fn_args_layout ( )
2394
2390
. to_list_tactic ( arg_items. len ( ) ) ,
2395
2391
Separator :: Comma ,
2396
2392
one_line_budget,
@@ -2677,7 +2673,7 @@ fn rewrite_where_clause(
2677
2673
where_clause : & ast:: WhereClause ,
2678
2674
brace_style : BraceStyle ,
2679
2675
shape : Shape ,
2680
- density : Density ,
2676
+ on_new_line : bool ,
2681
2677
terminator : & str ,
2682
2678
span_end : Option < BytePos > ,
2683
2679
span_end_before_where : BytePos ,
@@ -2757,7 +2753,7 @@ fn rewrite_where_clause(
2757
2753
} else {
2758
2754
terminator. len ( )
2759
2755
} ;
2760
- if density == Density :: Tall
2756
+ if on_new_line
2761
2757
|| preds_str. contains ( '\n' )
2762
2758
|| shape. indent . width ( ) + " where " . len ( ) + preds_str. len ( ) + end_length > shape. width
2763
2759
{
@@ -2848,7 +2844,7 @@ fn format_generics(
2848
2844
& generics. where_clause ,
2849
2845
brace_style,
2850
2846
Shape :: legacy ( budget, offset. block_only ( ) ) ,
2851
- Density :: Tall ,
2847
+ true ,
2852
2848
"{" ,
2853
2849
Some ( span. hi ( ) ) ,
2854
2850
span_end_before_where,
0 commit comments