@@ -252,6 +252,7 @@ pub(crate) fn rewrite_with_parens<'a, T: 'a + IntoOverflowableItem<'a>>(
252252 span : Span ,
253253 item_max_width : usize ,
254254 force_separator_tactic : Option < SeparatorTactic > ,
255+ force_list_tactic : Option < ListTactic > ,
255256) -> Option < String > {
256257 Context :: new (
257258 context,
@@ -263,6 +264,7 @@ pub(crate) fn rewrite_with_parens<'a, T: 'a + IntoOverflowableItem<'a>>(
263264 ")" ,
264265 item_max_width,
265266 force_separator_tactic,
267+ force_list_tactic,
266268 None ,
267269 )
268270 . rewrite ( shape)
@@ -286,6 +288,7 @@ pub(crate) fn rewrite_with_angle_brackets<'a, T: 'a + IntoOverflowableItem<'a>>(
286288 context. config . max_width ( ) ,
287289 None ,
288290 None ,
291+ None ,
289292 )
290293 . rewrite ( shape)
291294}
@@ -314,6 +317,7 @@ pub(crate) fn rewrite_with_square_brackets<'a, T: 'a + IntoOverflowableItem<'a>>
314317 rhs,
315318 context. config . array_width ( ) ,
316319 force_separator_tactic,
320+ None ,
317321 Some ( ( "[" , "]" ) ) ,
318322 )
319323 . rewrite ( shape)
@@ -331,6 +335,7 @@ struct Context<'a> {
331335 item_max_width : usize ,
332336 one_line_width : usize ,
333337 force_separator_tactic : Option < SeparatorTactic > ,
338+ force_list_tactic : Option < ListTactic > ,
334339 custom_delims : Option < ( & ' a str , & ' a str ) > ,
335340}
336341
@@ -345,6 +350,7 @@ impl<'a> Context<'a> {
345350 suffix : & ' static str ,
346351 item_max_width : usize ,
347352 force_separator_tactic : Option < SeparatorTactic > ,
353+ force_list_tactic : Option < ListTactic > ,
348354 custom_delims : Option < ( & ' a str , & ' a str ) > ,
349355 ) -> Context < ' a > {
350356 let used_width = extra_offset ( ident, shape) ;
@@ -369,6 +375,7 @@ impl<'a> Context<'a> {
369375 item_max_width,
370376 one_line_width,
371377 force_separator_tactic,
378+ force_list_tactic,
372379 custom_delims,
373380 }
374381 }
@@ -584,6 +591,23 @@ impl<'a> Context<'a> {
584591 _ => ( ) ,
585592 }
586593
594+ match self . force_list_tactic {
595+ Some ( list_tactic) if list_tactic == ListTactic :: Mixed => {
596+ if tactic != DefinitiveListTactic :: Horizontal {
597+ tactic = DefinitiveListTactic :: Mixed
598+ }
599+ }
600+ Some ( list_tactic) if list_tactic != ListTactic :: Mixed => {
601+ tactic = definitive_tactic (
602+ & * list_items,
603+ list_tactic,
604+ Separator :: Comma ,
605+ self . one_line_width ,
606+ )
607+ }
608+ _ => { }
609+ } ;
610+
587611 tactic
588612 }
589613
0 commit comments