Skip to content

Commit

Permalink
Fixed semicolon getting moved into comment (fixes rust-lang#4646)
Browse files Browse the repository at this point in the history
  • Loading branch information
vallentin committed Jan 17, 2021
1 parent a97fd77 commit 20bbca6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/formatting/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,11 @@ impl<'a> FmtVisitor<'a> {
FnBraceStyle::None,
)?;

// If `result` ends with a comment, then remember to add a newline
if last_line_contains_single_line_comment(&result) {
result.push_str(&indent.to_string_with_newline(context.config));
}

// Re-attach semicolon
result.push(';');

Expand Down

0 comments on commit 20bbca6

Please sign in to comment.