@@ -1566,7 +1566,7 @@ fn rewrite_static(
15661566 context. config . space_before_colon ( ) ,
15671567 context. config . space_after_colon ( ) ,
15681568 ) ;
1569- let prefix = format ! (
1569+ let mut prefix = format ! (
15701570 "{}{}{} {}{}{}" ,
15711571 format_visibility( static_parts. vis) ,
15721572 static_parts. defaultness. map_or( "" , format_defaultness) ,
@@ -1578,7 +1578,18 @@ fn rewrite_static(
15781578 // 2 = " =".len()
15791579 let ty_shape =
15801580 Shape :: indented ( offset. block_only ( ) , context. config ) . offset_left ( prefix. len ( ) + 2 ) ?;
1581- let ty_str = static_parts. ty . rewrite ( context, ty_shape) ?;
1581+ let ty_str = match static_parts. ty . rewrite ( context, ty_shape) {
1582+ Some ( ty_str) => ty_str,
1583+ None => {
1584+ if prefix. ends_with ( ' ' ) {
1585+ prefix. pop ( ) ;
1586+ }
1587+ let nested_indent = offset. block_indent ( context. config ) ;
1588+ let nested_shape = Shape :: indented ( nested_indent, context. config ) ;
1589+ let ty_str = static_parts. ty . rewrite ( context, nested_shape) ?;
1590+ format ! ( "\n {}{}" , nested_indent. to_string( context. config) , ty_str)
1591+ }
1592+ } ;
15821593
15831594 if let Some ( expr) = static_parts. expr_opt {
15841595 let lhs = format ! ( "{}{} =" , prefix, ty_str) ;
0 commit comments