Skip to content

Commit

Permalink
Fix RuleSet.remove (#3685)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser authored Mar 23, 2023
1 parent 189c9d4 commit 6161e56
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crates/ruff/src/registry/rule_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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![]);
}
}

0 comments on commit 6161e56

Please sign in to comment.