Fix as indentation

This commit is contained in:
Joshua Warner 2024-12-14 20:33:24 -08:00
parent 7b9aa59d64
commit f7baa878f2
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
6 changed files with 72 additions and 4 deletions

View file

@ -365,18 +365,24 @@ fn fmt_ty_ann(
buf.push('(')
}
buf.indent(indent);
let lhs_indent = buf.cur_line_indent();
lhs.value
.format_with_options(buf, Parens::InAsPattern, Newlines::No, indent);
buf.spaces(1);
format_spaces(buf, spaces, newlines, indent);
buf.indent(indent);
buf.indent(lhs_indent + INDENT);
buf.push_str("as");
buf.spaces(1);
buf.push_str(name.value);
for var in *vars {
buf.spaces(1);
var.value
.format_with_options(buf, Parens::NotNeeded, Newlines::No, indent);
var.value.format_with_options(
buf,
Parens::NotNeeded,
Newlines::No,
lhs_indent + INDENT,
);
}
if write_parens {