fix empty record with only comments in it

This commit is contained in:
Sébastien Besnier 2020-12-28 17:37:47 +01:00
parent b1bf03e7a0
commit 2f3d74e8bd
3 changed files with 31 additions and 1 deletions

View file

@ -809,7 +809,7 @@ pub fn fmt_record<'a>(
final_comments: &'a [CommentOrNewline<'a>],
indent: u16,
) {
if loc_fields.is_empty() {
if loc_fields.is_empty() && final_comments.iter().all(|c| c.is_newline()) {
buf.push_str("{}");
} else {
buf.push('{');