@@ -367,31 +367,29 @@ where
367367 result. push_str ( & comment) ;
368368
369369 if !inner_item. is_empty ( ) {
370- match tactic {
371- DefinitiveListTactic :: SpecialMacro ( _)
372- | DefinitiveListTactic :: Vertical
373- | DefinitiveListTactic :: Mixed => {
374- // We cannot keep pre-comments on the same line if the comment is normalized
375- let keep_comment = if formatting. config . normalize_comments ( )
376- || item. pre_comment_style == ListItemCommentStyle :: DifferentLine
377- {
378- false
379- } else {
380- // We will try to keep the comment on the same line with the item here.
381- // 1 = ` `
382- let total_width = total_item_width ( item) + item_sep_len + 1 ;
383- total_width <= formatting. shape . width
384- } ;
385- if keep_comment {
386- result. push ( ' ' ) ;
387- } else {
388- result. push ( '\n' ) ;
389- result. push_str ( indent_str) ;
390- // This is the width of the item (without comments).
391- line_len = item. item . as_ref ( ) . map_or ( 0 , |s| unicode_str_width ( & s) ) ;
392- }
370+ use DefinitiveListTactic :: * ;
371+ if matches ! ( tactic, Vertical | Mixed | SpecialMacro ( _) ) {
372+ // We cannot keep pre-comments on the same line if the comment is normalized.
373+ let keep_comment = if formatting. config . normalize_comments ( )
374+ || item. pre_comment_style == ListItemCommentStyle :: DifferentLine
375+ {
376+ false
377+ } else {
378+ // We will try to keep the comment on the same line with the item here.
379+ // 1 = ` `
380+ let total_width = total_item_width ( item) + item_sep_len + 1 ;
381+ total_width <= formatting. shape . width
382+ } ;
383+ if keep_comment {
384+ result. push ( ' ' ) ;
385+ } else {
386+ result. push ( '\n' ) ;
387+ result. push_str ( indent_str) ;
388+ // This is the width of the item (without comments).
389+ line_len = item. item . as_ref ( ) . map_or ( 0 , |s| unicode_str_width ( & s) ) ;
393390 }
394- _ => result. push ( ' ' ) ,
391+ } else {
392+ result. push ( ' ' )
395393 }
396394 }
397395 item_max_width = None ;
0 commit comments