First pass on fixes

This commit is contained in:
Piotr Osiewicz 2025-08-19 14:23:59 +02:00
parent 5826d89b97
commit 2f3be75fc7
269 changed files with 1593 additions and 2574 deletions

View file

@ -530,11 +530,10 @@ where
debug_assert!(self.stack.is_empty() || self.stack.last().unwrap().tree.0.is_leaf());
let mut end = self.position.clone();
if bias == Bias::Left {
if let Some(summary) = self.item_summary() {
if bias == Bias::Left
&& let Some(summary) = self.item_summary() {
end.add_summary(summary, self.cx);
}
}
target.cmp(&end, self.cx) == Ordering::Equal
}

View file

@ -674,12 +674,11 @@ impl<T: KeyedItem> SumTree<T> {
*self = {
let mut cursor = self.cursor::<T::Key>(cx);
let mut new_tree = cursor.slice(&item.key(), Bias::Left);
if let Some(cursor_item) = cursor.item() {
if cursor_item.key() == item.key() {
if let Some(cursor_item) = cursor.item()
&& cursor_item.key() == item.key() {
replaced = Some(cursor_item.clone());
cursor.next();
}
}
new_tree.push(item, cx);
new_tree.append(cursor.suffix(), cx);
new_tree
@ -692,12 +691,11 @@ impl<T: KeyedItem> SumTree<T> {
*self = {
let mut cursor = self.cursor::<T::Key>(cx);
let mut new_tree = cursor.slice(key, Bias::Left);
if let Some(item) = cursor.item() {
if item.key() == *key {
if let Some(item) = cursor.item()
&& item.key() == *key {
removed = Some(item.clone());
cursor.next();
}
}
new_tree.append(cursor.suffix(), cx);
new_tree
};
@ -736,12 +734,11 @@ impl<T: KeyedItem> SumTree<T> {
old_item = cursor.item();
}
if let Some(old_item) = old_item {
if old_item.key() == new_key {
if let Some(old_item) = old_item
&& old_item.key() == new_key {
removed.push(old_item.clone());
cursor.next();
}
}
match edit {
Edit::Insert(item) => {