@@ -1567,7 +1567,7 @@ fn rewrite_static(
1567
1567
context. config . space_before_colon ( ) ,
1568
1568
context. config . space_after_colon ( ) ,
1569
1569
) ;
1570
- let prefix = format ! (
1570
+ let mut prefix = format ! (
1571
1571
"{}{}{} {}{}{}" ,
1572
1572
format_visibility( static_parts. vis) ,
1573
1573
static_parts. defaultness. map_or( "" , format_defaultness) ,
@@ -1579,7 +1579,18 @@ fn rewrite_static(
1579
1579
// 2 = " =".len()
1580
1580
let ty_shape =
1581
1581
Shape :: indented ( offset. block_only ( ) , context. config ) . offset_left ( prefix. len ( ) + 2 ) ?;
1582
- let ty_str = static_parts. ty . rewrite ( context, ty_shape) ?;
1582
+ let ty_str = match static_parts. ty . rewrite ( context, ty_shape) {
1583
+ Some ( ty_str) => ty_str,
1584
+ None => {
1585
+ if prefix. ends_with ( ' ' ) {
1586
+ prefix. pop ( ) ;
1587
+ }
1588
+ let nested_indent = offset. block_indent ( context. config ) ;
1589
+ let nested_shape = Shape :: indented ( nested_indent, context. config ) ;
1590
+ let ty_str = static_parts. ty . rewrite ( context, nested_shape) ?;
1591
+ format ! ( "\n {}{}" , nested_indent. to_string( context. config) , ty_str)
1592
+ }
1593
+ } ;
1583
1594
1584
1595
if let Some ( expr) = static_parts. expr_opt {
1585
1596
let lhs = format ! ( "{}{} =" , prefix, ty_str) ;
0 commit comments