Fix RuleSet.remove (#3685)

This commit is contained in:
Micha Reiser 2023-03-23 18:01:37 +01:00 committed by GitHub
parent 189c9d4683
commit 6161e56ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -111,7 +111,7 @@ impl RuleSet {
let mut i = 0;
while i < self.0.len() {
self.0[i] ^= other.0[i];
self.0[i] &= !other.0[i];
i += 1;
}
@ -362,4 +362,15 @@ mod tests {
let expected_rules: Vec<_> = Rule::iter().collect();
assert_eq!(all_rules, expected_rules);
}
#[test]
fn remove_not_existing_rule_from_set() {
let mut set = RuleSet::default();
set.remove(Rule::AmbiguousFunctionName);
assert!(!set.contains(Rule::AmbiguousFunctionName));
assert!(set.is_empty());
assert_eq!(set.into_iter().collect::<Vec<_>>(), vec![]);
}
}