File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -220,14 +220,17 @@ pub mod linear {
220220 } ,
221221 } ;
222222
223+ /* re-inserting buckets may cause changes in size, so remember what
224+ our new size is ahead of time before we start insertions */
225+ let size = self . size - 1 ;
223226 idx = self . next_bucket ( idx, len_buckets) ;
224227 while self . buckets [ idx] . is_some ( ) {
225228 let mut bucket = None ;
226229 bucket <-> self . buckets [ idx] ;
227230 self . insert_opt_bucket ( bucket) ;
228231 idx = self . next_bucket ( idx, len_buckets) ;
229232 }
230- self . size -= 1 ;
233+ self . size = size ;
231234
232235 value
233236 }
@@ -428,7 +431,6 @@ pub mod linear {
428431 impl < T : Hash IterBytes Eq > LinearSet < T > : Container {
429432 /// Return the number of elements in the set
430433 pure fn len ( & self ) -> uint { self . map . len ( ) }
431-
432434 /// Return true if the set contains no elements
433435 pure fn is_empty ( & self ) -> bool { self . map . is_empty ( ) }
434436 }
You can’t perform that action at this time.
0 commit comments