Skip to content

Commit

Permalink
Remove unused BatchContainer methods (#451)
Browse files Browse the repository at this point in the history
* Remove BatchContainer::reserve

* Remove BatchContainer::copy_slice
  • Loading branch information
frankmcsherry authored Dec 23, 2023
1 parent 304ed9d commit 621340d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 51 deletions.
7 changes: 0 additions & 7 deletions src/trace/implementations/huffman_container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ where
}
}
}
fn copy_slice(&mut self, slice: &[Vec<B>]) {
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));
Expand All @@ -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(); }
Expand Down
44 changes: 0 additions & 44 deletions src/trace/implementations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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())
}
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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())
}
Expand All @@ -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());
Expand All @@ -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)));
Expand Down Expand Up @@ -533,11 +505,6 @@ pub mod containers {
}
self.offsets.push(self.inner.len());
}
fn copy_slice(&mut self, slice: &[Vec<B>]) {
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));
Expand All @@ -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);
Expand Down Expand Up @@ -640,8 +605,6 @@ pub mod containers {
}
}
}



impl<B> BatchContainer for SliceContainer2<B>
where
Expand All @@ -664,11 +627,6 @@ pub mod containers {
}
self.offsets.push(self.inner.len());
}
fn copy_slice(&mut self, slice: &[Vec<B>]) {
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));
Expand All @@ -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);
Expand Down

0 comments on commit 621340d

Please sign in to comment.