Merge pull request #7468 from joshuawarner32/fuzzing-bugs-9

And... more fuzzing bugs!
This commit is contained in:
Luke Boswell 2025-01-06 14:28:18 +11:00 committed by GitHub
commit 89ef225f5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 499 additions and 279 deletions

View file

@ -1814,14 +1814,17 @@ fn fmt_return<'a>(
buf.indent(indent);
buf.push_str(keyword::RETURN);
let return_indent = if return_value.is_multiline() {
let value = expr_lift_spaces(parens, buf.text.bump(), &return_value.value);
let return_indent = if value.item.is_multiline()
|| (newlines == Newlines::Yes && !value.before.is_empty())
|| value.before.iter().any(|s| s.is_comment())
{
indent + INDENT
} else {
indent
};
let value = expr_lift_spaces(parens, buf.text.bump(), &return_value.value);
if !value.before.is_empty() {
format_spaces(buf, value.before, newlines, return_indent);
}
@ -2057,15 +2060,17 @@ fn fmt_record_like<'a, 'b: 'a, Field, ToSpacesAround>(
// doesnt make sense.
Some(RecordPrefix::Update(record_var)) => {
buf.spaces(1);
record_var.format(buf, indent);
buf.indent(indent);
buf.push_str(" &");
record_var.format(buf, indent + INDENT);
buf.indent(indent + INDENT);
buf.ensure_ends_with_whitespace();
buf.push_str("&");
}
Some(RecordPrefix::Mapper(mapper_var)) => {
buf.spaces(1);
mapper_var.format(buf, indent);
buf.indent(indent);
buf.push_str(" <-");
mapper_var.format(buf, indent + INDENT);
buf.indent(indent + INDENT);
buf.ensure_ends_with_whitespace();
buf.push_str("<-");
}
}