This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +54
-4
lines changed Expand file tree Collapse file tree 3 files changed +54
-4
lines changed Original file line number Diff line number Diff line change @@ -94,10 +94,16 @@ impl Rewrite for ast::Local {
9494
9595 if let Some ( ref ty) = self . ty {
9696 let separator = type_annotation_separator ( context. config ) ;
97- let indent = shape. indent + last_line_width ( & result) + separator. len ( ) ;
98- // 1 = ;
99- let budget = shape. width . checked_sub ( indent. width ( ) + 1 ) ?;
100- let rewrite = ty. rewrite ( context, Shape :: legacy ( budget, indent) ) ?;
97+ let ty_shape = if pat_str. contains ( '\n' ) {
98+ shape. with_max_width ( context. config )
99+ } else {
100+ shape
101+ }
102+ . offset_left ( last_line_width ( & result) + separator. len ( ) ) ?
103+ // 2 = ` =`
104+ . sub_width ( 2 ) ?;
105+
106+ let rewrite = ty. rewrite ( context, ty_shape) ?;
101107
102108 infix. push_str ( separator) ;
103109 infix. push_str ( & rewrite) ;
Original file line number Diff line number Diff line change @@ -91,3 +91,25 @@ macro_rules! foo {
9191}
9292
9393type Target = ( FooAPI ) + ' static ;
94+
95+ // #3117
96+ fn issue3117 ( ) {
97+ {
98+ {
99+ {
100+ {
101+ {
102+ {
103+ {
104+ {
105+ let opt: & mut Option < MyLongTypeHere > =
106+ unsafe { & mut * self . future . get ( ) } ;
107+ }
108+ }
109+ }
110+ }
111+ }
112+ }
113+ }
114+ }
115+ }
Original file line number Diff line number Diff line change @@ -90,3 +90,25 @@ macro_rules! foo {
9090}
9191
9292type Target = ( FooAPI ) + ' static ;
93+
94+ // #3117
95+ fn issue3117 ( ) {
96+ {
97+ {
98+ {
99+ {
100+ {
101+ {
102+ {
103+ {
104+ let opt: & mut Option < MyLongTypeHere > =
105+ unsafe { & mut * self . future . get ( ) } ;
106+ }
107+ }
108+ }
109+ }
110+ }
111+ }
112+ }
113+ }
114+ }
You can’t perform that action at this time.
0 commit comments