fix EnumSet::is_subset

Fix by @Gankro!
This commit is contained in:
Alex Crichton 2014-11-06 15:41:50 -08:00
parent 65805bffe7
commit 2655abdd39
1 changed files with 7 additions and 2 deletions

View File

@ -100,7 +100,7 @@ impl<E:CLike> EnumSet<E> {
/// Returns `true` if this `EnumSet` is included in the given `EnumSet`.
#[unstable = "matches collection reform specification, waiting for dust to settle"]
pub fn is_subset(&self, other: &EnumSet<E>) -> bool {
other.is_subset(self)
other.is_superset(self)
}
/// Returns the union of both `EnumSets`.
@ -302,8 +302,13 @@ mod test {
e2.insert(A);
e2.insert(B);
assert!(!e1.is_superset(&e2));
let mut e3: EnumSet<Foo> = EnumSet::new();
e3.insert(C);
assert!(e1.is_subset(&e2));
assert!(e2.is_superset(&e1));
assert!(!e3.is_superset(&e2))
assert!(!e2.is_superset(&e3))
}
#[test]