Skip to content

Commit 97ec417

Browse files
committed
Add trailing comma when using mixed layout with block indent
1 parent 636de83 commit 97ec417

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/lists.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,10 @@ where
172172

173173
let limit = match tactic {
174174
_ if pre_line_comments => return DefinitiveListTactic::Vertical,
175-
ListTactic::Mixed => return DefinitiveListTactic::Mixed,
176175
ListTactic::Horizontal => return DefinitiveListTactic::Horizontal,
177176
ListTactic::Vertical => return DefinitiveListTactic::Vertical,
178177
ListTactic::LimitedHorizontalVertical(limit) => ::std::cmp::min(width, limit),
179-
ListTactic::HorizontalVertical => width,
178+
ListTactic::Mixed | ListTactic::HorizontalVertical => width,
180179
};
181180

182181
let (sep_count, total_width) = calculate_width(items.clone());
@@ -188,7 +187,10 @@ where
188187
{
189188
DefinitiveListTactic::Horizontal
190189
} else {
191-
DefinitiveListTactic::Vertical
190+
match tactic {
191+
ListTactic::Mixed => DefinitiveListTactic::Mixed,
192+
_ => DefinitiveListTactic::Vertical,
193+
}
192194
}
193195
}
194196

@@ -276,8 +278,7 @@ where
276278

277279
if last && formatting.ends_with_newline {
278280
match formatting.trailing_separator {
279-
SeparatorTactic::Always => separate = true,
280-
SeparatorTactic::Vertical if result.contains('\n') => separate = true,
281+
SeparatorTactic::Always | SeparatorTactic::Vertical => separate = true,
281282
_ => (),
282283
}
283284
}

0 commit comments

Comments
 (0)