@@ -111,7 +111,7 @@ impl Rewrite for ast::Local {
111
111
// 1 = trailing semicolon;
112
112
let nested_shape = shape. sub_width ( 1 ) ?;
113
113
114
- result = rewrite_assign_rhs ( context, result, ex, nested_shape) ?;
114
+ result = rewrite_assign_rhs ( context, result, & * * ex, nested_shape) ?;
115
115
}
116
116
117
117
result. push ( ';' ) ;
@@ -550,7 +550,7 @@ impl<'a> FmtVisitor<'a> {
550
550
ast:: VariantData :: Unit ( ..) => if let Some ( ref expr) = field. node . disr_expr {
551
551
let lhs = format ! ( "{} =" , field. node. name) ;
552
552
// 1 = ','
553
- rewrite_assign_rhs ( & context, lhs, expr, shape. sub_width ( 1 ) ?) ?
553
+ rewrite_assign_rhs ( & context, lhs, & * * expr, shape. sub_width ( 1 ) ?) ?
554
554
} else {
555
555
field. node . name . to_string ( )
556
556
} ,
@@ -1593,7 +1593,7 @@ fn rewrite_static(
1593
1593
rewrite_assign_rhs (
1594
1594
context,
1595
1595
lhs,
1596
- expr,
1596
+ & * * expr,
1597
1597
Shape :: legacy ( remaining_width, offset. block_only ( ) ) ,
1598
1598
) . and_then ( |res| {
1599
1599
recover_comment_removed ( res, static_parts. span , context)
@@ -1613,10 +1613,9 @@ pub fn rewrite_associated_type(
1613
1613
) -> Option < String > {
1614
1614
let prefix = format ! ( "type {}" , ident) ;
1615
1615
1616
- let type_bounds_str = if let Some ( ty_param_bounds ) = ty_param_bounds_opt {
1616
+ let type_bounds_str = if let Some ( ref bounds ) = ty_param_bounds_opt {
1617
1617
// 2 = ": ".len()
1618
1618
let shape = Shape :: indented ( indent, context. config ) . offset_left ( prefix. len ( ) + 2 ) ?;
1619
- let bounds: & [ _ ] = ty_param_bounds;
1620
1619
let bound_str = bounds
1621
1620
. iter ( )
1622
1621
. map ( |ty_bound| ty_bound. rewrite ( context, shape) )
@@ -1631,14 +1630,10 @@ pub fn rewrite_associated_type(
1631
1630
} ;
1632
1631
1633
1632
if let Some ( ty) = ty_opt {
1634
- let ty_str = ty. rewrite (
1635
- context,
1636
- Shape :: legacy (
1637
- context. budget ( indent. block_indent + prefix. len ( ) + 2 ) ,
1638
- indent. block_only ( ) ,
1639
- ) ,
1640
- ) ?;
1641
- Some ( format ! ( "{}{} = {};" , prefix, type_bounds_str, ty_str) )
1633
+ // 1 = `;`
1634
+ let shape = Shape :: indented ( indent, context. config ) . sub_width ( 1 ) ?;
1635
+ let lhs = format ! ( "{}{} =" , prefix, type_bounds_str) ;
1636
+ rewrite_assign_rhs ( context, lhs, & * * ty, shape) . map ( |s| s + ";" )
1642
1637
} else {
1643
1638
Some ( format ! ( "{}{};" , prefix, type_bounds_str) )
1644
1639
}
0 commit comments