Merge pull request #3454 from rtfeldman/fix-opaque-formatting

Fix unstable formatting of opaque tag unions
This commit is contained in:
Folkert de Vries 2022-07-08 22:22:00 +02:00 committed by GitHub
commit 8c5f798f4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 18 deletions

View file

@ -95,8 +95,6 @@ impl<'a> Formattable for TypeDef<'a> {
let ann_is_where_clause =
matches!(ann.extract_spaces().item, TypeAnnotation::Where(..));
let ann_has_spaces_before = matches!(&ann.value, TypeAnnotation::SpaceBefore(..));
// Always put the has-derived clause on a newline if it is itself multiline, or
// the annotation has a where-has clause.
let derived_multiline = if let Some(derived) = derived {
@ -107,12 +105,6 @@ impl<'a> Formattable for TypeDef<'a> {
let make_multiline = ann.is_multiline() || derived_multiline;
// If the annotation has spaces before, a newline will already be printed.
if make_multiline && !ann_has_spaces_before {
buf.newline();
buf.indent(indent + INDENT);
}
ann.format(buf, indent);
if let Some(derived) = derived {