mbe: Remove Vec reference in container

This commit is contained in:
Jonas Platte 2022-09-14 23:35:12 +02:00
parent b6aed7914d
commit 54305545a5
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -253,7 +253,7 @@ impl BindingsBuilder {
&'a self, &'a self,
id: usize, id: usize,
len: usize, len: usize,
nested_refs: &mut Vec<&'a Vec<LinkNode<Rc<BindingKind>>>>, nested_refs: &mut Vec<&'a [LinkNode<Rc<BindingKind>>]>,
) { ) {
self.nested[id].iter().take(len).for_each(|it| match it { self.nested[id].iter().take(len).for_each(|it| match it {
LinkNode::Node(id) => nested_refs.push(&self.nodes[*id]), LinkNode::Node(id) => nested_refs.push(&self.nodes[*id]),
@ -263,7 +263,7 @@ impl BindingsBuilder {
fn collect_nested(&self, idx: usize, nested_idx: usize, nested: &mut Vec<Bindings>) { fn collect_nested(&self, idx: usize, nested_idx: usize, nested: &mut Vec<Bindings>) {
let last = &self.nodes[idx]; let last = &self.nodes[idx];
let mut nested_refs = Vec::new(); let mut nested_refs: Vec<&[_]> = Vec::new();
self.nested[nested_idx].iter().for_each(|it| match *it { self.nested[nested_idx].iter().for_each(|it| match *it {
LinkNode::Node(idx) => nested_refs.push(&self.nodes[idx]), LinkNode::Node(idx) => nested_refs.push(&self.nodes[idx]),
LinkNode::Parent { idx, len } => self.collect_nested_ref(idx, len, &mut nested_refs), LinkNode::Parent { idx, len } => self.collect_nested_ref(idx, len, &mut nested_refs),