mirror of
https://github.com/RGBCube/alejandra
synced 2025-08-01 21:17:45 +00:00
refactor: simplify code
This commit is contained in:
parent
774b685411
commit
2e8f26ff1a
1 changed files with 4 additions and 14 deletions
|
@ -19,20 +19,10 @@ pub mod string;
|
||||||
pub mod string_interpol;
|
pub mod string_interpol;
|
||||||
|
|
||||||
pub fn default(
|
pub fn default(
|
||||||
build_ctx: &crate::builder::BuildCtx,
|
_: &crate::builder::BuildCtx,
|
||||||
node: &rnix::SyntaxNode,
|
node: &rnix::SyntaxNode,
|
||||||
) -> std::collections::LinkedList<crate::builder::Step> {
|
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||||
let mut steps = std::collections::LinkedList::new();
|
node.children_with_tokens()
|
||||||
|
.map(|child| crate::builder::Step::Format(child.into()))
|
||||||
let mut children = crate::children::Children::new(build_ctx, node);
|
.collect()
|
||||||
|
|
||||||
while let Some(child) = children.get_next() {
|
|
||||||
let step = match build_ctx.vertical {
|
|
||||||
true => crate::builder::Step::FormatWider(child.element),
|
|
||||||
_ => crate::builder::Step::Format(child.element),
|
|
||||||
};
|
|
||||||
steps.push_back(step);
|
|
||||||
}
|
|
||||||
|
|
||||||
steps
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue