Skip to content

Commit 2e8f26f

Browse files
committed
refactor: simplify code
1 parent 774b685 commit 2e8f26f

File tree

1 file changed

+4
-14
lines changed
  • src/alejandra_engine/src/rules

1 file changed

+4
-14
lines changed

src/alejandra_engine/src/rules/mod.rs

+4-14
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,10 @@ pub mod string;
1919
pub mod string_interpol;
2020

2121
pub fn default(
22-
build_ctx: &crate::builder::BuildCtx,
22+
_: &crate::builder::BuildCtx,
2323
node: &rnix::SyntaxNode,
2424
) -> std::collections::LinkedList<crate::builder::Step> {
25-
let mut steps = std::collections::LinkedList::new();
26-
27-
let mut children = crate::children::Children::new(build_ctx, node);
28-
29-
while let Some(child) = children.get_next() {
30-
let step = match build_ctx.vertical {
31-
true => crate::builder::Step::FormatWider(child.element),
32-
_ => crate::builder::Step::Format(child.element),
33-
};
34-
steps.push_back(step);
35-
}
36-
37-
steps
25+
node.children_with_tokens()
26+
.map(|child| crate::builder::Step::Format(child.into()))
27+
.collect()
3828
}

0 commit comments

Comments
 (0)