Skip to content

Commit

Permalink
Better way to avoid indenting twice
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Oct 21, 2024
1 parent f224bec commit c07d540
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tooling/nargo_fmt/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ impl<'a> Formatter<'a> {
}

/// Writes the current indentation to the buffer, but only if the buffer
/// does not end with a space (otherwise we'd be indenting too much).
/// is empty or it ends with a newline (otherwise we'd be indenting when not needed).
fn write_indentation(&mut self) {
if self.buffer.ends_with(' ') {
if !(self.buffer.is_empty() || self.buffer.ends_with('\n')) {
return;
}

Expand Down

0 comments on commit c07d540

Please sign in to comment.