@@ -15,7 +15,7 @@ use crate::comment::{
1515 FindUncommented ,
1616} ;
1717use crate :: config:: lists:: * ;
18- use crate :: config:: { BraceStyle , Config , Density , IndentStyle , Version } ;
18+ use crate :: config:: { BraceStyle , Config , IndentStyle , Version } ;
1919use crate :: expr:: {
2020 format_expr, is_empty_block, is_simple_block_stmt, rewrite_assign_rhs, rewrite_assign_rhs_with,
2121 ExprType , RhsTactics ,
@@ -703,7 +703,7 @@ pub(crate) fn format_impl(
703703 & generics. where_clause ,
704704 context. config . brace_style ( ) ,
705705 Shape :: legacy ( where_budget, offset. block_only ( ) ) ,
706- Density :: Vertical ,
706+ false ,
707707 "{" ,
708708 where_span_end,
709709 self_ty. span . hi ( ) ,
@@ -1044,11 +1044,7 @@ pub(crate) fn format_trait(
10441044
10451045 // Rewrite where-clause.
10461046 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 ;
10521048
10531049 let where_budget = context. budget ( last_line_width ( & result) ) ;
10541050 let pos_before_where = if generic_bounds. is_empty ( ) {
@@ -1062,7 +1058,7 @@ pub(crate) fn format_trait(
10621058 & generics. where_clause ,
10631059 context. config . brace_style ( ) ,
10641060 Shape :: legacy ( where_budget, offset. block_only ( ) ) ,
1065- where_density ,
1061+ where_on_new_line ,
10661062 "{" ,
10671063 None ,
10681064 pos_before_where,
@@ -1171,7 +1167,7 @@ impl<'a> Rewrite for TraitAliasBounds<'a> {
11711167 & self . generics . where_clause ,
11721168 context. config . brace_style ( ) ,
11731169 shape,
1174- Density :: Compressed ,
1170+ false ,
11751171 ";" ,
11761172 None ,
11771173 self . generics . where_clause . span . lo ( ) ,
@@ -1423,7 +1419,7 @@ fn format_tuple_struct(
14231419 & generics. where_clause ,
14241420 context. config . brace_style ( ) ,
14251421 Shape :: legacy ( where_budget, offset. block_only ( ) ) ,
1426- Density :: Compressed ,
1422+ false ,
14271423 ";" ,
14281424 None ,
14291425 body_hi,
@@ -1499,7 +1495,7 @@ fn rewrite_type_prefix(
14991495 & generics. where_clause ,
15001496 context. config . brace_style ( ) ,
15011497 Shape :: legacy ( where_budget, indent) ,
1502- Density :: Vertical ,
1498+ false ,
15031499 "=" ,
15041500 None ,
15051501 generics. span . hi ( ) ,
@@ -2258,7 +2254,7 @@ fn rewrite_fn_base(
22582254 where_clause,
22592255 context. config . brace_style ( ) ,
22602256 Shape :: indented ( indent, context. config ) ,
2261- Density :: Tall ,
2257+ true ,
22622258 "{" ,
22632259 Some ( span. hi ( ) ) ,
22642260 pos_before_where,
@@ -2390,7 +2386,7 @@ fn rewrite_args(
23902386 & arg_items,
23912387 context
23922388 . config
2393- . fn_args_density ( )
2389+ . fn_args_layout ( )
23942390 . to_list_tactic ( arg_items. len ( ) ) ,
23952391 Separator :: Comma ,
23962392 one_line_budget,
@@ -2677,7 +2673,7 @@ fn rewrite_where_clause(
26772673 where_clause : & ast:: WhereClause ,
26782674 brace_style : BraceStyle ,
26792675 shape : Shape ,
2680- density : Density ,
2676+ on_new_line : bool ,
26812677 terminator : & str ,
26822678 span_end : Option < BytePos > ,
26832679 span_end_before_where : BytePos ,
@@ -2757,7 +2753,7 @@ fn rewrite_where_clause(
27572753 } else {
27582754 terminator. len ( )
27592755 } ;
2760- if density == Density :: Tall
2756+ if on_new_line
27612757 || preds_str. contains ( '\n' )
27622758 || shape. indent . width ( ) + " where " . len ( ) + preds_str. len ( ) + end_length > shape. width
27632759 {
@@ -2848,7 +2844,7 @@ fn format_generics(
28482844 & generics. where_clause ,
28492845 brace_style,
28502846 Shape :: legacy ( budget, offset. block_only ( ) ) ,
2851- Density :: Tall ,
2847+ true ,
28522848 "{" ,
28532849 Some ( span. hi ( ) ) ,
28542850 span_end_before_where,
0 commit comments