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