1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-08-01 04:57:44 +00:00

Merge pull request #113 from kamadorueda/kamadorueda

feat: no space in empty containers
This commit is contained in:
Kevin Amado 2022-02-16 20:14:12 -05:00 committed by GitHub
commit 1de952b26a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 30 additions and 27 deletions

View file

@ -127,9 +127,11 @@ pub fn rule(
steps.push_back(crate::builder::Step::Pad);
}
crate::config::Layout::Wide => {
if items_count > 0 {
steps.push_back(crate::builder::Step::Whitespace);
}
}
}
steps.push_back(crate::builder::Step::Format(child.element));
steps

View file

@ -69,7 +69,9 @@ pub fn rule(
));
}
crate::config::Layout::Wide => {
if item_index > 1 {
steps.push_back(crate::builder::Step::Whitespace);
}
steps
.push_back(crate::builder::Step::Format(child.element));
}
@ -87,9 +89,7 @@ pub fn rule(
steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad);
}
crate::config::Layout::Wide => {
steps.push_back(crate::builder::Step::Whitespace);
}
crate::config::Layout::Wide => {}
}
steps.push_back(crate::builder::Step::Format(child.element));

View file

@ -153,8 +153,9 @@ pub fn rule(
// }
let child = children.get_next().unwrap();
steps.push_back(crate::builder::Step::Dedent);
if !has_comments_between_curly_b && items_count <= 1 {
if !has_comments_between_curly_b && items_count == 1 {
steps.push_back(crate::builder::Step::Whitespace);
} else if !has_comments_between_curly_b && items_count == 0 {
} else {
if let rnix::SyntaxKind::NODE_PAT_ENTRY = last_kind {
steps.push_back(crate::builder::Step::Token(