Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/cfg/src/dnf.rs')
| -rw-r--r-- | crates/cfg/src/dnf.rs | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/crates/cfg/src/dnf.rs b/crates/cfg/src/dnf.rs index f3ebca0465..424672a275 100644 --- a/crates/cfg/src/dnf.rs +++ b/crates/cfg/src/dnf.rs @@ -66,9 +66,9 @@ impl DnfExpr { } } - res.enabled.sort_unstable_by(compare); + res.enabled.sort_unstable(); res.enabled.dedup(); - res.disabled.sort_unstable_by(compare); + res.disabled.sort_unstable(); res.disabled.dedup(); Some(res) } @@ -114,25 +114,14 @@ impl DnfExpr { }; // Undo the FxHashMap randomization for consistent output. - diff.enable.sort_unstable_by(compare); - diff.disable.sort_unstable_by(compare); + diff.enable.sort_unstable(); + diff.disable.sort_unstable(); Some(diff) }) } } -fn compare(a: &CfgAtom, b: &CfgAtom) -> std::cmp::Ordering { - match (a, b) { - (CfgAtom::Flag(a), CfgAtom::Flag(b)) => a.as_str().cmp(b.as_str()), - (CfgAtom::Flag(_), CfgAtom::KeyValue { .. }) => std::cmp::Ordering::Less, - (CfgAtom::KeyValue { .. }, CfgAtom::Flag(_)) => std::cmp::Ordering::Greater, - (CfgAtom::KeyValue { key, value }, CfgAtom::KeyValue { key: key2, value: value2 }) => { - key.as_str().cmp(key2.as_str()).then(value.as_str().cmp(value2.as_str())) - } - } -} - impl fmt::Display for DnfExpr { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if self.conjunctions.len() != 1 { |