Skip to content

Commit 2655abd

Browse files
committed
fix EnumSet::is_subset
Fix by @gankro!
1 parent 65805bf commit 2655abd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/libcollections/enum_set.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<E:CLike> EnumSet<E> {
100100
/// Returns `true` if this `EnumSet` is included in the given `EnumSet`.
101101
#[unstable = "matches collection reform specification, waiting for dust to settle"]
102102
pub fn is_subset(&self, other: &EnumSet<E>) -> bool {
103-
other.is_subset(self)
103+
other.is_superset(self)
104104
}
105105

106106
/// Returns the union of both `EnumSets`.
@@ -302,8 +302,13 @@ mod test {
302302
e2.insert(A);
303303
e2.insert(B);
304304

305-
assert!(!e1.is_superset(&e2));
305+
let mut e3: EnumSet<Foo> = EnumSet::new();
306+
e3.insert(C);
307+
308+
assert!(e1.is_subset(&e2));
306309
assert!(e2.is_superset(&e1));
310+
assert!(!e3.is_superset(&e2))
311+
assert!(!e2.is_superset(&e3))
307312
}
308313

309314
#[test]

0 commit comments

Comments
 (0)