@@ -75,8 +75,6 @@ struct DictInner<T> {
75
75
filled : usize ,
76
76
indices : Vec < i64 > ,
77
77
entries : Vec < Option < DictEntry < T > > > ,
78
- // index to new inserted element should be in entries
79
- next_new_entry_idx : usize ,
80
78
}
81
79
82
80
impl < T : Clone > Clone for Dict < T > {
@@ -95,7 +93,6 @@ impl<T> Default for Dict<T> {
95
93
filled : 0 ,
96
94
indices : vec ! [ IndexEntry :: FREE ; 8 ] ,
97
95
entries : Vec :: new ( ) ,
98
- next_new_entry_idx : 0 ,
99
96
} ) ,
100
97
}
101
98
}
@@ -188,7 +185,6 @@ impl<T> DictInner<T> {
188
185
}
189
186
}
190
187
self . filled = self . used ;
191
- self . next_new_entry_idx = self . entries . len ( ) ;
192
188
}
193
189
194
190
fn unchecked_push (
@@ -205,15 +201,10 @@ impl<T> DictInner<T> {
205
201
value,
206
202
index,
207
203
} ;
208
- let entry_index = self . next_new_entry_idx ;
209
- if self . entries . len ( ) == entry_index {
210
- self . entries . push ( Some ( entry) ) ;
211
- } else {
212
- self . entries [ entry_index] = Some ( entry) ;
213
- }
204
+ let entry_index = self . entries . len ( ) ;
205
+ self . entries . push ( Some ( entry) ) ;
214
206
self . indices [ index] = entry_index as i64 ;
215
207
self . used += 1 ;
216
- self . next_new_entry_idx += 1 ;
217
208
if let IndexEntry :: Free = index_entry {
218
209
self . filled += 1 ;
219
210
if let Some ( new_size) = self . should_resize ( ) {
@@ -347,7 +338,6 @@ impl<T: Clone> Dict<T> {
347
338
inner. indices . resize ( 8 , IndexEntry :: FREE ) ;
348
339
inner. used = 0 ;
349
340
inner. filled = 0 ;
350
- inner. next_new_entry_idx = 0 ;
351
341
// defer dec rc
352
342
std:: mem:: take ( & mut inner. entries )
353
343
} ;
@@ -653,7 +643,6 @@ impl<T: Clone> Dict<T> {
653
643
} ;
654
644
inner. used -= 1 ;
655
645
inner. indices [ entry. index ] = IndexEntry :: DUMMY ;
656
- inner. next_new_entry_idx = inner. entries . len ( ) ;
657
646
Some ( ( entry. key , entry. value ) )
658
647
}
659
648
0 commit comments