@@ -54,12 +54,12 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, mark
54
54
pos = unsafe { new_pos. cast_to_leaf_unchecked ( ) } ;
55
55
56
56
// Only if we merged, the parent (if any) has shrunk, but skipping
57
- // the following step does not pay off in benchmarks.
57
+ // the following step otherwise does not pay off in benchmarks.
58
58
//
59
59
// SAFETY: We won't destroy or rearrange the leaf where `pos` is at
60
60
// by handling its parent recursively; at worst we will destroy or
61
61
// rearrange the parent through the grandparent, thus change the
62
- // leaf's parent pointer .
62
+ // link to the parent inside the leaf .
63
63
if let Ok ( parent) = unsafe { pos. reborrow_mut ( ) } . into_node ( ) . ascend ( ) {
64
64
parent. into_node ( ) . handle_shrunk_node_recursively ( handle_emptied_internal_root) ;
65
65
}
@@ -90,8 +90,8 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>,
90
90
}
91
91
92
92
impl < ' a , K : ' a , V : ' a > NodeRef < marker:: Mut < ' a > , K , V , marker:: Internal > {
93
- /// Stocks up a possibly underfull internal node, recursively.
94
- /// Climbs up until it reaches an ancestor that has elements to spare or the root.
93
+ /// Stocks up a possibly underfull internal node and its ancestors,
94
+ /// until it reaches an ancestor that has elements to spare or is the root.
95
95
fn handle_shrunk_node_recursively < F : FnOnce ( ) > ( mut self , handle_emptied_internal_root : F ) {
96
96
loop {
97
97
self = match self . len ( ) {
@@ -122,7 +122,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
122
122
) -> Option < NodeRef < marker:: Mut < ' a > , K , V , marker:: Internal > > {
123
123
match self . forget_type ( ) . choose_parent_kv ( ) {
124
124
Ok ( Left ( left_parent_kv) ) => {
125
- debug_assert ! ( left_parent_kv. right_child_len( ) == MIN_LEN - 1 ) ;
125
+ debug_assert_eq ! ( left_parent_kv. right_child_len( ) , MIN_LEN - 1 ) ;
126
126
if left_parent_kv. can_merge ( ) {
127
127
let pos = left_parent_kv. merge ( None ) ;
128
128
let parent_edge = unsafe { unwrap_unchecked ( pos. into_node ( ) . ascend ( ) . ok ( ) ) } ;
@@ -134,7 +134,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
134
134
}
135
135
}
136
136
Ok ( Right ( right_parent_kv) ) => {
137
- debug_assert ! ( right_parent_kv. left_child_len( ) == MIN_LEN - 1 ) ;
137
+ debug_assert_eq ! ( right_parent_kv. left_child_len( ) , MIN_LEN - 1 ) ;
138
138
if right_parent_kv. can_merge ( ) {
139
139
let pos = right_parent_kv. merge ( None ) ;
140
140
let parent_edge = unsafe { unwrap_unchecked ( pos. into_node ( ) . ascend ( ) . ok ( ) ) } ;
0 commit comments