Skip to content

Commit 5e2f9e3

Browse files
committed
mbe: Return Bindings from build_inner
1 parent dbb8fed commit 5e2f9e3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

crates/mbe/src/expander/matcher.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,11 @@ impl BindingsBuilder {
203203
}
204204

205205
fn build(self, idx: &BindingsIdx) -> Bindings {
206-
let mut bindings = Bindings::default();
207-
self.build_inner(&mut bindings, &self.nodes[idx.0]);
208-
bindings
206+
self.build_inner(&self.nodes[idx.0])
209207
}
210208

211-
fn build_inner(&self, bindings: &mut Bindings, link_nodes: &[LinkNode<Rc<BindingKind>>]) {
209+
fn build_inner(&self, link_nodes: &[LinkNode<Rc<BindingKind>>]) -> Bindings {
210+
let mut bindings = Bindings::default();
212211
let mut nodes = Vec::new();
213212
self.collect_nodes(link_nodes, &mut nodes);
214213

@@ -246,6 +245,8 @@ impl BindingsBuilder {
246245
}
247246
}
248247
}
248+
249+
bindings
249250
}
250251

251252
fn collect_nested_ref<'a>(
@@ -270,8 +271,7 @@ impl BindingsBuilder {
270271
nested_refs.push(last);
271272

272273
nested_refs.into_iter().for_each(|iter| {
273-
let mut child_bindings = Bindings::default();
274-
self.build_inner(&mut child_bindings, iter);
274+
let child_bindings = self.build_inner(iter);
275275
nested.push(child_bindings)
276276
})
277277
}

0 commit comments

Comments
 (0)