chore: cargo fix

This commit is contained in:
Zixuan Chen 2022-08-16 17:05:50 +08:00
parent 722893cdb2
commit da8b2668e7
4 changed files with 9 additions and 9 deletions

View file

@ -1,7 +1,7 @@
use std::{
borrow::{Borrow, BorrowMut},
cell::{Ref, RefCell, RefMut},
ops::{Deref, DerefMut, Range, RangeBounds},
ops::{Range},
rc::Rc,
};

View file

@ -97,8 +97,8 @@ impl<'a, T: Rle, A: RleTreeTrait<T>> Node<'a, T, A> {
.children
.iter()
.position(|child| match (child, self) {
(Node::Internal(a), Node::Internal(b)) => std::ptr::eq(&*a, &*b),
(Node::Leaf(a), Node::Leaf(b)) => std::ptr::eq(&*a, &*b),
(Node::Internal(a), Node::Internal(b)) => std::ptr::eq(a, b),
(Node::Leaf(a), Node::Leaf(b)) => std::ptr::eq(a, b),
_ => false,
});
@ -117,9 +117,9 @@ impl<'a, T: Rle, A: RleTreeTrait<T>> Node<'a, T, A> {
let index = self.get_self_index()?;
let parent = self.parent()?;
if index > 0 {
Some((&parent.children[index - 1], Either::Left))
Some((parent.children[index - 1], Either::Left))
} else if index + 1 < parent.children.len() {
Some((&parent.children[index + 1], Either::Right))
Some((parent.children[index + 1], Either::Right))
} else {
None
}

View file

@ -21,7 +21,7 @@ impl<'a, T: Rle, A: RleTreeTrait<T>> InternalNode<'a, T, A> {
#[inline]
fn _split(&mut self) -> &'a mut Node<'a, T, A> {
let mut ans = self
let ans = self
.bump
.alloc(Node::Internal(Self::new(self.bump, self.parent)));
let inner_ptr = NonNull::new(&mut *ans.as_internal_mut().unwrap()).unwrap();
@ -139,12 +139,12 @@ impl<'a, T: Rle, A: RleTreeTrait<T>> InternalNode<'a, T, A> {
Node::Internal(node) => {
if let Err(new) = node._delete(Some(del_from), None, visited, depth + 1)
{
result = self._insert_with_split(direct_delete_start, new.into());
result = self._insert_with_split(direct_delete_start, new);
}
}
Node::Leaf(node) => {
if let Err(new) = node.delete(Some(del_from), None) {
result = self._insert_with_split(direct_delete_start, new.into())
result = self._insert_with_split(direct_delete_start, new)
}
}
}

View file

@ -20,7 +20,7 @@ impl<'a, T: Rle, A: RleTreeTrait<T>> LeafNode<'a, T, A> {
#[inline]
fn _split(&mut self) -> &'a mut Node<'a, T, A> {
let mut ans = self
let ans = self
.bump
.alloc(Node::Leaf(Self::new(self.bump, self.parent)));
let mut inner = ans.as_leaf_mut().unwrap();