about summary refs log tree commit diff
path: root/tvix/eval/src/value/string.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-11-22T19·35+0300
committertazjin <tazjin@tvl.su>2023-11-25T15·48+0000
commit5ffb99786429de1cf830b5aefa251705c5434055 (patch)
tree47e9f94e3a6a127026feaa7a141d5835d78cbd3f /tvix/eval/src/value/string.rs
parentac3025e883d4dba7516ad24d7dd6e1410e4d1769 (diff)
fix(tvix): ensure PartialOrd/Ord agree for StorePath & NixString r/7064
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>
Diffstat (limited to 'tvix/eval/src/value/string.rs')
-rw-r--r--tvix/eval/src/value/string.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/tvix/eval/src/value/string.rs b/tvix/eval/src/value/string.rs
index c8624a6d62..8a69e060c6 100644
--- a/tvix/eval/src/value/string.rs
+++ b/tvix/eval/src/value/string.rs
@@ -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))
     }
 }