diff --git a/crates/aiken-lang/src/format.rs b/crates/aiken-lang/src/format.rs index 93195461..8bd474e2 100644 --- a/crates/aiken-lang/src/format.rs +++ b/crates/aiken-lang/src/format.rs @@ -1458,7 +1458,6 @@ impl<'comments> Formatter<'comments> { fn clause<'a>(&mut self, clause: &'a UntypedClause, index: u32) -> Document<'a> { let space_before = self.pop_empty_lines(clause.location.start); - let after_position = clause.location.end; let clause_doc = join( clause.patterns.iter().map(|p| self.pattern(p)), " | ".to_doc(), @@ -1468,9 +1467,6 @@ impl<'comments> Formatter<'comments> { Some(guard) => clause_doc.append(" if ").append(self.clause_guard(guard)), }; - // Remove any unused empty lines within the clause - self.pop_empty_lines(after_position); - if index == 0 { clause_doc } else if space_before { diff --git a/crates/aiken-lang/src/tests/format.rs b/crates/aiken-lang/src/tests/format.rs index 0a686b6c..b8c5c876 100644 --- a/crates/aiken-lang/src/tests/format.rs +++ b/crates/aiken-lang/src/tests/format.rs @@ -133,17 +133,28 @@ fn test_format_when() { let src = indoc! {r#" pub fn foo( a) { when a is{ - True -> 14 + True -> { + + bar() + + 14 + } False -> - 42} + + 42 + + } } "#}; let expected = indoc! {r#" pub fn foo(a) { when a is { - True -> + True -> { + bar() + 14 + } False -> 42 }