Skip to content

Commit 03dce2b

Browse files
authored
fix: use alphabetical order in Ord and PartialOrd impls on RuleDomain (#5311)
1 parent 1505d46 commit 03dce2b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

crates/biome_analyze/src/rule.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ impl RuleSourceKind {
479479
}
480480

481481
/// Rule domains
482-
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
482+
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
483483
#[cfg_attr(
484484
feature = "serde",
485485
derive(
@@ -513,6 +513,19 @@ impl Display for RuleDomain {
513513
}
514514
}
515515

516+
impl Ord for RuleDomain {
517+
fn cmp(&self, other: &Self) -> Ordering {
518+
// Rule domains should be in alphabetical order
519+
format!("{self:?}").cmp(&format!("{other:?}"))
520+
}
521+
}
522+
523+
impl PartialOrd for RuleDomain {
524+
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
525+
Some(self.cmp(other))
526+
}
527+
}
528+
516529
impl RuleDomain {
517530
/// If the project has one of these dependencies, the domain will be automatically enabled, unless it's explicitly disabled by the configuration.
518531
///

0 commit comments

Comments
 (0)