From a6e1abde7e85026860eca3174d5222c46aa72a3d Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Sun, 5 Dec 2021 20:12:58 +0100 Subject: [PATCH] rust: alloc: remove spurious file Signed-off-by: Miguel Ojeda --- .../collections/btree/dedup_sorted_iter.rs | 47 ------------------- 1 file changed, 47 deletions(-) delete mode 100644 rust/alloc/collections/btree/dedup_sorted_iter.rs diff --git a/rust/alloc/collections/btree/dedup_sorted_iter.rs b/rust/alloc/collections/btree/dedup_sorted_iter.rs deleted file mode 100644 index 60bf83b8387c38..00000000000000 --- a/rust/alloc/collections/btree/dedup_sorted_iter.rs +++ /dev/null @@ -1,47 +0,0 @@ -use core::iter::Peekable; - -/// A iterator for deduping the key of a sorted iterator. -/// When encountering the duplicated key, only the last key-value pair is yielded. -/// -/// Used by [`BTreeMap::bulk_build_from_sorted_iter`]. -pub struct DedupSortedIter -where - I: Iterator, -{ - iter: Peekable, -} - -impl DedupSortedIter -where - I: Iterator, -{ - pub fn new(iter: I) -> Self { - Self { iter: iter.peekable() } - } -} - -impl Iterator for DedupSortedIter -where - K: Eq, - I: Iterator, -{ - type Item = (K, V); - - fn next(&mut self) -> Option<(K, V)> { - loop { - let next = match self.iter.next() { - Some(next) => next, - None => return None, - }; - - let peeked = match self.iter.peek() { - Some(peeked) => peeked, - None => return Some(next), - }; - - if next.0 != peeked.0 { - return Some(next); - } - } - } -}