@@ -323,8 +323,10 @@ pub fn rewrite_use_list(shape: Shape,
323
323
_ => ( ) ,
324
324
}
325
325
326
- // 2 = {}
327
- let remaining_width = shape. width . checked_sub ( path_str. len ( ) + 2 ) . unwrap_or ( 0 ) ;
326
+ let colons_offset = if path_str. is_empty ( ) { 0 } else { 2 } ;
327
+
328
+ // 2 = "{}"
329
+ let remaining_width = shape. width . checked_sub ( path_str. len ( ) + 2 + colons_offset) . unwrap_or ( 0 ) ;
328
330
329
331
let mut items = {
330
332
// Dummy value, see explanation below.
@@ -351,20 +353,18 @@ pub fn rewrite_use_list(shape: Shape,
351
353
items[ 1 ..] . sort_by ( |a, b| a. item . cmp ( & b. item ) ) ;
352
354
}
353
355
354
- let colons_offset = if path_str. is_empty ( ) { 0 } else { 2 } ;
355
356
356
357
let tactic = definitive_tactic ( & items[ first_index..] ,
357
358
:: lists:: ListTactic :: Mixed ,
358
359
remaining_width) ;
360
+
359
361
let fmt = ListFormatting {
360
362
tactic : tactic,
361
363
separator : "," ,
362
364
trailing_separator : SeparatorTactic :: Never ,
363
- // FIXME This is too conservative, and will not use all width
364
- // available
365
- // (loose 1 column (";"))
365
+ // Add one to the indent to account for "{"
366
366
shape : Shape :: legacy ( remaining_width,
367
- shape. indent + path_str. len ( ) + 1 + colons_offset ) ,
367
+ shape. indent + path_str. len ( ) + colons_offset + 1 ) ,
368
368
ends_with_newline : false ,
369
369
config : context. config ,
370
370
} ;
0 commit comments