1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-30 12:07:46 +00:00

refactor: simplify code

This commit is contained in:
Kevin Amado 2022-02-25 22:37:45 -05:00
parent 774b685411
commit 2e8f26ff1a

View file

@ -19,20 +19,10 @@ pub mod string;
pub mod string_interpol;
pub fn default(
build_ctx: &crate::builder::BuildCtx,
_: &crate::builder::BuildCtx,
node: &rnix::SyntaxNode,
) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node);
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
node.children_with_tokens()
.map(|child| crate::builder::Step::Format(child.into()))
.collect()
}