about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonas Platte <jplatte+git@posteo.de>2022-09-14 23:22:38 +0200
committerJonas Platte <jplatte+git@posteo.de>2022-09-14 23:22:38 +0200
commit5e2f9e322fbb886c51b0baf8c0653acd56329d48 (patch)
tree6df5d8a4755a933c4dd18e83996de406a63dd2f1
parentdbb8fedf8b887adfde3b445f9ec4bdf11da9ae9f (diff)
downloadrust-5e2f9e322fbb886c51b0baf8c0653acd56329d48.tar.gz
rust-5e2f9e322fbb886c51b0baf8c0653acd56329d48.zip
mbe: Return Bindings from build_inner
-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)
         })
     }