fix(tvix): ensure PartialOrd/Ord agree for StorePath & NixString

This fixes a *future* clippy lint:
https://rust-lang.github.io/rust-clippy/master/index.html#/incorrect_partial_ord_impl_on_ord_type

In essence, because the implementation of *both* Ord and PartialOrd
implies that ordering is not partial, all results of PartialOrd should
simply be those of Ord. This is to avoid subtle bugs in future
refactorings.

Change-Id: I8fc6694010208752dd47746a2aaaeca0c788d574
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10109
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Vincent Ambo 2023-11-22 22:35:14 +03:00 committed by tazjin
parent ac3025e883
commit 5ffb997864
2 changed files with 2 additions and 2 deletions

View file

@ -27,7 +27,7 @@ impl Eq for NixString {}
impl PartialOrd for NixString {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.as_str().partial_cmp(other.as_str())
Some(self.cmp(other))
}
}

View file

@ -70,7 +70,7 @@ impl StorePath {
impl PartialOrd for StorePath {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.digest.partial_cmp(&other.digest)
Some(self.cmp(other))
}
}