Skip to content

Commit

Permalink
fix a formatting bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Jun 26, 2024
1 parent 4a974d7 commit 4daba71
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -956,10 +956,7 @@ impl<'a> Formatter<'a> {
let add_leading_newline = any_multiline
&& !(br.value.lines.first()).is_some_and(|line| line.is_empty());
if add_leading_newline {
self.output.push('\n');
for _ in 0..self.config.multiline_indent * (depth + 1) {
self.output.push(' ');
}
self.newline(depth + 1);
}
} else {
self.output.push('|');
Expand All @@ -982,10 +979,7 @@ impl<'a> Formatter<'a> {
&& br.value.lines.last().is_some_and(|line| !line.is_empty())
&& !self.output.trim_end_matches(' ').ends_with('\n')
{
self.output.push('\n');
for _ in 0..self.config.multiline_indent * depth {
self.output.push(' ');
}
self.newline(depth);
}
}
self.output.push(')');
Expand Down Expand Up @@ -1187,7 +1181,7 @@ impl<'a> Formatter<'a> {
self.config.multiline_indent * depth
};
for (i, line) in lines.iter().enumerate() {
if i > 0 || (prevent_compact && depth > 0) || (!compact && allow_leading_space) {
if i > 0 || (!compact && allow_leading_space) {
self.output.push('\n');
if !line.is_empty() {
for _ in 0..indent {
Expand Down

0 comments on commit 4daba71

Please sign in to comment.