Skip to content

Commit

Permalink
fix a formatter bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Jun 15, 2024
1 parent d058919 commit 6b70677
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,11 +930,7 @@ impl<'a> Formatter<'a> {
self.output.push(if use_angle { '⟨' } else { '(' });
let any_multiline = pack.branches.iter().any(|br| {
br.value.lines.len() > 1
|| br
.value
.lines
.iter()
.flatten()
|| (br.value.lines.iter().flatten())
.any(|word| word_is_multiline(&word.value))
});
for (i, br) in pack.branches.iter().enumerate() {
Expand Down Expand Up @@ -973,7 +969,7 @@ impl<'a> Formatter<'a> {
self.format_multiline_words(&br.value.lines, false, false, depth + 1);
if any_multiline
&& br.value.lines.last().is_some_and(|line| !line.is_empty())
&& !self.output.ends_with('\n')
&& !self.output.trim_end_matches(' ').ends_with('\n')
{
self.output.push('\n');
for _ in 0..self.config.multiline_indent * depth {
Expand Down

0 comments on commit 6b70677

Please sign in to comment.