Skip to content

Commit 232e0c2

Browse files
kinto-bPhilippe-Cholet
authored andcommitted
Remove MergeBy::last and MergeBy::count
It is faster to rely on new `MergeBy::fold` implementation
1 parent 8583689 commit 232e0c2

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

Diff for: src/merge_join.rs

-46
Original file line numberDiff line numberDiff line change
@@ -308,52 +308,6 @@ where
308308
F::size_hint(self.left.size_hint(), self.right.size_hint())
309309
}
310310

311-
fn count(mut self) -> usize {
312-
let mut count = 0;
313-
loop {
314-
match (self.left.next(), self.right.next()) {
315-
(None, None) => break count,
316-
(Some(_left), None) => break count + 1 + self.left.into_parts().1.count(),
317-
(None, Some(_right)) => break count + 1 + self.right.into_parts().1.count(),
318-
(Some(left), Some(right)) => {
319-
count += 1;
320-
let (left, right, _) = self.cmp_fn.merge(left, right);
321-
if let Some(left) = left {
322-
self.left.put_back(left);
323-
}
324-
if let Some(right) = right {
325-
self.right.put_back(right);
326-
}
327-
}
328-
}
329-
}
330-
}
331-
332-
fn last(mut self) -> Option<Self::Item> {
333-
let mut previous_element = None;
334-
loop {
335-
match (self.left.next(), self.right.next()) {
336-
(None, None) => break previous_element,
337-
(Some(left), None) => {
338-
break Some(F::left(self.left.into_parts().1.last().unwrap_or(left)))
339-
}
340-
(None, Some(right)) => {
341-
break Some(F::right(self.right.into_parts().1.last().unwrap_or(right)))
342-
}
343-
(Some(left), Some(right)) => {
344-
let (left, right, elem) = self.cmp_fn.merge(left, right);
345-
if let Some(left) = left {
346-
self.left.put_back(left);
347-
}
348-
if let Some(right) = right {
349-
self.right.put_back(right);
350-
}
351-
previous_element = Some(elem);
352-
}
353-
}
354-
}
355-
}
356-
357311
fn nth(&mut self, mut n: usize) -> Option<Self::Item> {
358312
loop {
359313
if n == 0 {

0 commit comments

Comments
 (0)