Skip to content

Commit

Permalink
chore: review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
a-frantz committed Jan 15, 2025
1 parent c0e446d commit b3a2631
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion wdl-format/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub enum TriviaBlankLineSpacingPolicy {
///
/// i.e. a comment, then a blank line, then code, would have the blank
/// removed.
BeforeComments,
RemoveTrailingBlanks,
/// Blank lines are always allowed.
#[default]
Always,
Expand Down
2 changes: 1 addition & 1 deletion wdl-format/src/token/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ impl Postprocessor {
TriviaBlankLineSpacingPolicy::Always => {
self.blank_line(stream);
}
TriviaBlankLineSpacingPolicy::BeforeComments => {
TriviaBlankLineSpacingPolicy::RemoveTrailingBlanks => {
if matches!(next, Some(&PreToken::Trivia(Trivia::Comment(_)))) {
self.blank_line(stream);
}
Expand Down
7 changes: 4 additions & 3 deletions wdl-format/src/token/pre.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,18 @@ impl TokenStream<PreToken> {
self.0.push(PreToken::IndentEnd);
}

/// Inserts a blank lines allowed context change.
/// Inserts a trivial blank lines "always allowed" context change.
pub fn blank_lines_allowed(&mut self) {
self.0.push(PreToken::LineSpacingPolicy(
TriviaBlankLineSpacingPolicy::Always,
));
}

/// Inserts a blank lines allowed before comments context change.
/// Inserts a trivial blank lines "not allowed after comments" context
/// change.
pub fn blank_lines_allowed_between_comments(&mut self) {
self.0.push(PreToken::LineSpacingPolicy(
TriviaBlankLineSpacingPolicy::BeforeComments,
TriviaBlankLineSpacingPolicy::RemoveTrailingBlanks,
));
}

Expand Down

0 comments on commit b3a2631

Please sign in to comment.