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:
commit
1de952b26a
10 changed files with 30 additions and 27 deletions
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue