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

View file

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