Don't write extra newline if it's already there

This commit is contained in:
Ayaz Hafiz 2022-09-13 14:56:16 -04:00
parent 1bbe56248c
commit 6a83babaf3
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -340,8 +340,10 @@ impl<'a> Formattable for TypeAnnotation<'a> {
Newlines::No
};
buf.newline();
buf.indent(indent);
if !buf.ends_with_newline() {
buf.newline();
buf.indent(indent);
}
fmt_comments_only(buf, spaces.iter(), NewlineAt::Bottom, indent);
ann.format_with_options(buf, parens, next_newlines, indent)
}
@ -519,7 +521,12 @@ impl<'a> Formattable for Tag<'a> {
for arg in *args {
buf.newline();
arg.format_with_options(buf, Parens::InApply, Newlines::No, arg_indent);
arg.value.format_with_options(
buf,
Parens::InApply,
Newlines::No,
arg_indent,
);
}
} else {
for arg in *args {