Several fixes found in fuzzing

This commit is contained in:
Joshua Warner 2024-11-29 18:52:54 -08:00
parent e9caada3f1
commit b9862b47dc
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
49 changed files with 1060 additions and 523 deletions

View file

@ -43,6 +43,7 @@ pub enum Parens {
InApply,
InOperator,
InAsPattern,
InApplyLastArg,
}
/// In an AST node, do we show newlines around it
@ -238,6 +239,7 @@ fn fmt_ty_ann(
let is_first = index == 0;
if !is_first {
buf.indent(indent);
buf.push_str(",");
if !self_is_multiline {
buf.spaces(1);

View file

@ -1009,7 +1009,7 @@ pub fn fmt_body<'a>(
return body.format_with_options(buf, Parens::NotNeeded, Newlines::No, indent);
}
pattern.format_with_options(buf, Parens::InApply, Newlines::No, indent);
pattern.format_with_options(buf, Parens::NotNeeded, Newlines::No, indent);
buf.indent(indent);
buf.push_str(" =");

File diff suppressed because it is too large Load diff

View file

@ -204,7 +204,6 @@ fn fmt_pattern_inner(
if it.peek().is_some() {
buf.push_str(",");
buf.spaces(1);
}
if !item.after.is_empty() {
@ -218,6 +217,9 @@ fn fmt_pattern_inner(
fmt_spaces(buf, item.after.iter(), indent);
}
}
if it.peek().is_some() {
buf.ensure_ends_with_whitespace();
}
}
buf.spaces(1);
}