File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,13 @@ pub mod chained {
167
167
pure fn is_empty ( & self ) -> bool { self . count == 0 }
168
168
}
169
169
170
+ impl < K : Eq IterBytes Hash , V > T < K , V > : Mutable {
171
+ fn clear ( & mut self ) {
172
+ self . count = 0 u;
173
+ self . chains = chains ( initial_capacity) ;
174
+ }
175
+ }
176
+
170
177
impl < K : Eq IterBytes Hash Copy , V : Copy > T < K , V > {
171
178
pure fn contains_key_ref ( k : & K ) -> bool {
172
179
let hash = k. hash_keyed ( 0 , 0 ) as uint ;
@@ -309,11 +316,6 @@ pub mod chained {
309
316
}
310
317
}
311
318
312
- fn clear ( ) {
313
- self . count = 0 u;
314
- self . chains = chains ( initial_capacity) ;
315
- }
316
-
317
319
pure fn each ( blk : fn ( key : K , value : V ) -> bool ) {
318
320
self . each_ref ( |k, v| blk ( * k, * v) )
319
321
}
@@ -655,7 +657,7 @@ mod tests {
655
657
#[ test]
656
658
fn test_clear ( ) {
657
659
let key = ~"k";
658
- let map = HashMap :: < ~str , ~str > ( ) ;
660
+ let mut map = HashMap :: < ~str , ~str > ( ) ;
659
661
map. insert ( key, ~"val") ;
660
662
assert ( map. len ( ) == 1 ) ;
661
663
assert ( map. contains_key_ref ( & key) ) ;
You can’t perform that action at this time.
0 commit comments