Skip to content

Commit ad7c5f4

Browse files
committed
---
yaml --- r: 128474 b: refs/heads/auto c: dcccf82 h: refs/heads/master v: v3
1 parent 1fc8bd4 commit ad7c5f4

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 40c45169b7b280bbe27380fc5f1c350d25946ec2
16+
refs/heads/auto: dcccf824b1096cc596671724ebf42b8d3ed35705
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libcollections/bitv.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ impl Set<uint> for BitvSet {
15221522

15231523
#[inline]
15241524
fn is_disjoint(&self, other: &BitvSet) -> bool {
1525-
self.intersection(other).count() > 0
1525+
self.intersection(other).next().is_none()
15261526
}
15271527

15281528
#[inline]
@@ -2264,6 +2264,24 @@ mod tests {
22642264
assert!(set1.is_subset(&set2)); // { 2 } { 2, 4 }
22652265
}
22662266

2267+
#[test]
2268+
fn test_bitv_set_is_disjoint() {
2269+
let a = BitvSet::from_bitv(from_bytes([0b10100010]));
2270+
let b = BitvSet::from_bitv(from_bytes([0b01000000]));
2271+
let c = BitvSet::new();
2272+
let d = BitvSet::from_bitv(from_bytes([0b00110000]));
2273+
2274+
assert!(!a.is_disjoint(&d));
2275+
assert!(!d.is_disjoint(&a));
2276+
2277+
assert!(a.is_disjoint(&b))
2278+
assert!(a.is_disjoint(&c))
2279+
assert!(b.is_disjoint(&a))
2280+
assert!(b.is_disjoint(&c))
2281+
assert!(c.is_disjoint(&a))
2282+
assert!(c.is_disjoint(&b))
2283+
}
2284+
22672285
#[test]
22682286
fn test_bitv_set_intersect_with() {
22692287
// Explicitly 0'ed bits

0 commit comments

Comments
 (0)