Fixes to autofmt, make it more aggressive (#2230)
* fix: fmt unterminated if, be more aggressive with line splits * Fix: Handle long exprs in for/if statements
This commit is contained in:
1 parent
46b0eeb12c
commit
be99e29e5f
31 files changed
+464
-117
No files matched your search
@@ -91,8 +91,11 @@ impl Writer<'_> {
|
||||
write!(self.out, ", ")?;
|
||||
}
|
||||
|
||||
for child in children {
|
||||
for (id, child) in children.iter().enumerate() {
|
||||
self.write_ident(child)?;
|
||||
if id != children.len() - 1 && children.len() > 1 {
|
||||
write!(self.out, ", ")?;
|
||||
}
|
||||
}
|
||||
|
||||
write!(self.out, " ")?;
|
||||
@@ -163,6 +166,10 @@ impl Writer<'_> {
|
||||
|
||||
let name = &field.name;
|
||||
match &field.content {
|
||||
ContentField::ManExpr(_exp) if field.can_be_shorthand() => {
|
||||
write!(self.out, "{name}")?;
|
||||
}
|
||||
|
||||
ContentField::ManExpr(exp) => {
|
||||
let out = unparse_expr(exp);
|
||||
let mut lines = out.split('\n').peekable();
|
||||
|
||||
Reference in new issue
Block a user