From 621340da1fb6cf3c2c238d8d65ca29cbc6f68d65 Mon Sep 17 00:00:00 2001 From: Frank McSherry Date: Sat, 23 Dec 2023 10:50:00 -0500 Subject: [PATCH] Remove unused `BatchContainer` methods (#451) * Remove BatchContainer::reserve * Remove BatchContainer::copy_slice --- .../implementations/huffman_container.rs | 7 --- src/trace/implementations/mod.rs | 44 ------------------- 2 files changed, 51 deletions(-) diff --git a/src/trace/implementations/huffman_container.rs b/src/trace/implementations/huffman_container.rs index 0bee80bbe..290b5d870 100644 --- a/src/trace/implementations/huffman_container.rs +++ b/src/trace/implementations/huffman_container.rs @@ -84,11 +84,6 @@ where } } } - fn copy_slice(&mut self, slice: &[Vec]) { - for item in slice { - self.copy_push(item); - } - } fn copy_range(&mut self, other: &Self, start: usize, end: usize) { for index in start .. end { self.copy(other.index(index)); @@ -103,8 +98,6 @@ where stats: Default::default(), } } - fn reserve(&mut self, _additional: usize) { - } fn merge_capacity(cont1: &Self, cont2: &Self) -> Self { if cont1.len() > 0 { cont1.print(); } diff --git a/src/trace/implementations/mod.rs b/src/trace/implementations/mod.rs index 2ef41901b..b6a50990c 100644 --- a/src/trace/implementations/mod.rs +++ b/src/trace/implementations/mod.rs @@ -290,12 +290,6 @@ impl BatchContainer for OffsetList { self.push(item.0); } - fn copy_slice(&mut self, slice: &[Self::PushItem]) { - for index in slice { - self.push(*index); - } - } - fn copy_range(&mut self, other: &Self, start: usize, end: usize) { for offset in start..end { self.push(other.index(offset)); @@ -306,10 +300,6 @@ impl BatchContainer for OffsetList { Self::with_capacity(size) } - fn reserve(&mut self, _additional: usize) { - // Nop - } - fn merge_capacity(cont1: &Self, cont2: &Self) -> Self { Self::with_capacity(cont1.len() + cont2.len()) } @@ -347,14 +337,10 @@ pub mod containers { fn copy_push(&mut self, item: &Self::PushItem); /// Inserts a borrowed item. fn copy(&mut self, item: Self::ReadItem<'_>); - /// Extends from a slice of items. - fn copy_slice(&mut self, slice: &[Self::PushItem]); /// Extends from a range of items in another`Self`. fn copy_range(&mut self, other: &Self, start: usize, end: usize); /// Creates a new container with sufficient capacity. fn with_capacity(size: usize) -> Self; - /// Reserves additional capacity. - fn reserve(&mut self, additional: usize); /// Creates a new container with sufficient capacity. fn merge_capacity(cont1: &Self, cont2: &Self) -> Self; @@ -432,18 +418,12 @@ pub mod containers { fn copy(&mut self, item: &T) { self.push(item.clone()); } - fn copy_slice(&mut self, slice: &[T]) { - self.extend_from_slice(slice); - } fn copy_range(&mut self, other: &Self, start: usize, end: usize) { self.extend_from_slice(&other[start .. end]); } fn with_capacity(size: usize) -> Self { Vec::with_capacity(size) } - fn reserve(&mut self, additional: usize) { - self.reserve(additional); - } fn merge_capacity(cont1: &Self, cont2: &Self) -> Self { Vec::with_capacity(cont1.len() + cont2.len()) } @@ -470,12 +450,6 @@ pub mod containers { fn copy(&mut self, item: &T) { self.copy(item); } - fn copy_slice(&mut self, slice: &[Self::PushItem]) { - self.reserve_items(slice.iter()); - for item in slice.iter() { - self.copy(item); - } - } fn copy_range(&mut self, other: &Self, start: usize, end: usize) { let slice = &other[start .. end]; self.reserve_items(slice.iter()); @@ -486,8 +460,6 @@ pub mod containers { fn with_capacity(size: usize) -> Self { Self::with_capacity(size) } - fn reserve(&mut self, _additional: usize) { - } fn merge_capacity(cont1: &Self, cont2: &Self) -> Self { let mut new = Self::default(); new.reserve_regions(std::iter::once(cont1).chain(std::iter::once(cont2))); @@ -533,11 +505,6 @@ pub mod containers { } self.offsets.push(self.inner.len()); } - fn copy_slice(&mut self, slice: &[Vec]) { - for item in slice { - self.copy(item); - } - } fn copy_range(&mut self, other: &Self, start: usize, end: usize) { for index in start .. end { self.copy(other.index(index)); @@ -551,8 +518,6 @@ pub mod containers { inner: Vec::with_capacity(size), } } - fn reserve(&mut self, _additional: usize) { - } fn merge_capacity(cont1: &Self, cont2: &Self) -> Self { let mut offsets = Vec::with_capacity(cont1.inner.len() + cont2.inner.len() + 1); offsets.push(0); @@ -640,8 +605,6 @@ pub mod containers { } } } - - impl BatchContainer for SliceContainer2 where @@ -664,11 +627,6 @@ pub mod containers { } self.offsets.push(self.inner.len()); } - fn copy_slice(&mut self, slice: &[Vec]) { - for item in slice { - self.copy_push(item); - } - } fn copy_range(&mut self, other: &Self, start: usize, end: usize) { for index in start .. end { self.copy(other.index(index)); @@ -683,8 +641,6 @@ pub mod containers { inner: Vec::with_capacity(size), } } - fn reserve(&mut self, _additional: usize) { - } fn merge_capacity(cont1: &Self, cont2: &Self) -> Self { let mut offsets = Vec::with_capacity(cont1.inner.len() + cont2.inner.len() + 1); offsets.push(0);