about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crates/mbe/src/expander/matcher.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/mbe/src/expander/matcher.rs b/crates/mbe/src/expander/matcher.rs
index c1aa14d6b7e..0d970504da4 100644
--- a/crates/mbe/src/expander/matcher.rs
+++ b/crates/mbe/src/expander/matcher.rs
@@ -203,12 +203,11 @@ impl BindingsBuilder {
     }
 
     fn build(self, idx: &BindingsIdx) -> Bindings {
-        let mut bindings = Bindings::default();
-        self.build_inner(&mut bindings, &self.nodes[idx.0]);
-        bindings
+        self.build_inner(&self.nodes[idx.0])
     }
 
-    fn build_inner(&self, bindings: &mut Bindings, link_nodes: &[LinkNode<Rc<BindingKind>>]) {
+    fn build_inner(&self, link_nodes: &[LinkNode<Rc<BindingKind>>]) -> Bindings {
+        let mut bindings = Bindings::default();
         let mut nodes = Vec::new();
         self.collect_nodes(link_nodes, &mut nodes);
 
@@ -246,6 +245,8 @@ impl BindingsBuilder {
                 }
             }
         }
+
+        bindings
     }
 
     fn collect_nested_ref<'a>(
@@ -270,8 +271,7 @@ impl BindingsBuilder {
         nested_refs.push(last);
 
         nested_refs.into_iter().for_each(|iter| {
-            let mut child_bindings = Bindings::default();
-            self.build_inner(&mut child_bindings, iter);
+            let child_bindings = self.build_inner(iter);
             nested.push(child_bindings)
         })
     }