File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1189,12 +1189,13 @@ fn format_tuple_struct(
1189
1189
result. push_str ( & header_str) ;
1190
1190
1191
1191
let body_lo = if fields. is_empty ( ) {
1192
- context. codemap . span_after ( span, "(" )
1192
+ let lo = get_bytepos_after_visibility ( context, vis, span, ")" ) ;
1193
+ context. codemap . span_after ( mk_sp ( lo, span. hi ( ) ) , "(" )
1193
1194
} else {
1194
1195
fields[ 0 ] . span . lo ( )
1195
1196
} ;
1196
1197
let body_hi = if fields. is_empty ( ) {
1197
- context. codemap . span_after ( span, ")" )
1198
+ context. codemap . span_after ( mk_sp ( body_lo , span. hi ( ) ) , ")" )
1198
1199
} else {
1199
1200
// This is a dirty hack to work around a missing `)` from the span of the last field.
1200
1201
let last_arg_span = fields[ fields. len ( ) - 1 ] . span ;
@@ -1242,7 +1243,10 @@ fn format_tuple_struct(
1242
1243
. to_string ( context. config ) )
1243
1244
}
1244
1245
result. push ( '(' ) ;
1245
- let snippet = context. snippet ( mk_sp ( body_lo, context. codemap . span_before ( span, ")" ) ) ) ;
1246
+ let snippet = context. snippet ( mk_sp (
1247
+ body_lo,
1248
+ context. codemap . span_before ( mk_sp ( body_lo, span. hi ( ) ) , ")" ) ,
1249
+ ) ) ;
1246
1250
if snippet. is_empty ( ) {
1247
1251
// `struct S ()`
1248
1252
} else if snippet. trim_right_matches ( & [ ' ' , '\t' ] [ ..] ) . ends_with ( '\n' ) {
You can’t perform that action at this time.
0 commit comments