File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
branches/snap-stage3/src/libcore Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: 0c3158b3a57129e8fb2a71ae0d0fceb985fc2098
4
+ refs/heads/snap-stage3: 6fdd1ef9b18039eb29d8c8ba322883a565e94e43
5
5
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
Original file line number Diff line number Diff line change @@ -229,6 +229,7 @@ mod linear {
229
229
self . insert_bucket ( bucket) ;
230
230
idx = self . next_bucket ( idx, len_buckets) ;
231
231
}
232
+ self . size -= 1 ;
232
233
ret true;
233
234
}
234
235
}
@@ -240,10 +241,14 @@ mod linear {
240
241
}
241
242
242
243
impl public_methods < K , V > for & const linear_map < K , V > {
243
- fn size ( ) -> uint {
244
+ fn len ( ) -> uint {
244
245
self . size
245
246
}
246
247
248
+ fn is_empty ( ) -> bool {
249
+ self . len ( ) == 0
250
+ }
251
+
247
252
fn contains_key ( k : & K ) -> bool {
248
253
alt self . bucket_for_key ( self . buckets , k) {
249
254
found_entry ( _) => { true }
@@ -377,6 +382,15 @@ mod test {
377
382
assert m. get ( & 5 ) == 3 ;
378
383
}
379
384
385
+ #[ test]
386
+ fn empty ( ) {
387
+ let mut m = ~linear:: linear_map_with_capacity ( uint_hash, uint_eq, 4 ) ;
388
+ assert m. insert ( 1 , 2 ) ;
389
+ assert !m. is_empty ( ) ;
390
+ assert m. remove ( & 1 ) ;
391
+ assert m. is_empty ( ) ;
392
+ }
393
+
380
394
#[ test]
381
395
fn iterate ( ) {
382
396
let mut m = linear:: linear_map_with_capacity ( uint_hash, uint_eq, 4 ) ;
You can’t perform that action at this time.
0 commit comments