File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -257,12 +257,16 @@ mod chained {
257
257
fn size ( ) -> uint { self . count }
258
258
259
259
fn insert ( k : K , v : V ) -> bool {
260
- let nchains = vec:: len ( self . chains ) ;
261
- let load = { num : ( self . count + 1 u) as int , den: nchains as int } ;
262
- // Structural consts would be nice. This is a const 3/4
263
- // load factor that we compare against.
264
- if !util:: rational_leq ( load, { num: 3 , den: 4 } ) { rehash ( self ) ; }
265
- ret insert( self , k, v) ;
260
+ let grew = insert ( self , k, v) ;
261
+ if grew {
262
+ let nchains = vec:: len ( self . chains ) ;
263
+ let load = { num : ( self . count + 1 u) as int ,
264
+ den: nchains as int } ;
265
+ // Structural consts would be nice. This is a const 3/4
266
+ // load factor that we compare against.
267
+ if !util:: rational_leq ( load, { num: 3 , den: 4 } ) { rehash ( self ) ; }
268
+ }
269
+ grew
266
270
}
267
271
268
272
fn contains_key ( k : K ) -> bool { option:: is_some ( get ( self , k) ) }
You can’t perform that action at this time.
0 commit comments