Skip to content

Commit 20bbca6

Browse files
committed
Fixed semicolon getting moved into comment (fixes rust-lang#4646)
1 parent a97fd77 commit 20bbca6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: src/formatting/items.rs

+5
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,11 @@ impl<'a> FmtVisitor<'a> {
434434
FnBraceStyle::None,
435435
)?;
436436

437+
// If `result` ends with a comment, then remember to add a newline
438+
if last_line_contains_single_line_comment(&result) {
439+
result.push_str(&indent.to_string_with_newline(context.config));
440+
}
441+
437442
// Re-attach semicolon
438443
result.push(';');
439444

0 commit comments

Comments
 (0)