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
@@ -296,3 +296,21 @@ fn normalize_path(name: &mut syn::Path) -> Option<AngleBracketedGenericArguments
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
impl ComponentField {
|
||||
pub fn can_be_shorthand(&self) -> bool {
|
||||
// If it's a shorthand...
|
||||
if matches!(self.content, ContentField::Shorthand(_)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If it's in the form of attr: attr, return true
|
||||
if let ContentField::ManExpr(Expr::Path(path)) = &self.content {
|
||||
if path.path.segments.len() == 1 && path.path.segments[0].ident == self.name {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user