Silence sum_tree warnings

* Remove unused enum variant
* Add #[allow(unused)] for non-trivial methods
This commit is contained in:
Max Brunsfeld 2021-04-02 14:39:56 -07:00
parent 575f5910fa
commit 32500e21f6
2 changed files with 5 additions and 3 deletions

View File

@ -133,6 +133,7 @@ where
None
}
#[allow(unused)]
pub fn prev(&mut self) {
assert!(self.did_seek, "Must seek before calling this method");
@ -385,6 +386,7 @@ where
self.seek_internal::<()>(pos, bias, &mut SeekAggregate::None)
}
#[allow(unused)]
pub fn seek_forward(&mut self, pos: &S, bias: SeekBias) -> bool {
self.seek_internal::<()>(pos, bias, &mut SeekAggregate::None)
}

View File

@ -54,6 +54,7 @@ impl<T: Item> SumTree<T> {
tree
}
#[allow(unused)]
pub fn items(&self) -> Vec<T> {
let mut cursor = self.cursor::<(), ()>();
cursor.descend_to_first_item(self, |_| true);
@ -320,6 +321,7 @@ impl<T: Item> SumTree<T> {
}
impl<T: KeyedItem> SumTree<T> {
#[allow(unused)]
pub fn insert(&mut self, item: T) {
*self = {
let mut cursor = self.cursor::<T::Key, ()>();
@ -363,7 +365,6 @@ impl<T: KeyedItem> SumTree<T> {
Edit::Insert(item) => {
buffered_items.push(item.clone());
}
Edit::Remove(_) => {}
}
}
@ -445,13 +446,12 @@ impl<T: Item> Node<T> {
#[derive(Debug)]
pub enum Edit<T: KeyedItem> {
Insert(T),
Remove(T),
}
impl<T: KeyedItem> Edit<T> {
fn key(&self) -> T::Key {
match self {
Edit::Insert(item) | Edit::Remove(item) => item.key(),
Edit::Insert(item) => item.key(),
}
}
}