Clarify variable and method names

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2021-05-14 16:42:46 +02:00
co-authored by Nathan Sobo
parent 0d50c74cab
commit 580fc4fed7
2 changed files with 22 additions and 26 deletions
+4 -8
View File
@@ -101,15 +101,11 @@ impl<T: Item> SumTree<T> {
self.rightmost_leaf().0.items().last()
}
pub fn with_last_mut(
&mut self,
f: impl FnOnce(&mut T),
ctx: &<T::Summary as Summary>::Context,
) {
self.with_last_mut_recursive(f, ctx);
pub fn update_last(&mut self, f: impl FnOnce(&mut T), ctx: &<T::Summary as Summary>::Context) {
self.update_last_recursive(f, ctx);
}
fn with_last_mut_recursive(
fn update_last_recursive(
&mut self,
f: impl FnOnce(&mut T),
ctx: &<T::Summary as Summary>::Context,
@@ -123,7 +119,7 @@ impl<T: Item> SumTree<T> {
} => {
let last_summary = child_summaries.last_mut().unwrap();
let last_child = child_trees.last_mut().unwrap();
*last_summary = last_child.with_last_mut_recursive(f, ctx).unwrap();
*last_summary = last_child.update_last_recursive(f, ctx).unwrap();
*summary = sum(child_summaries.iter(), ctx);
Some(summary.clone())
}