diff --git a/tvix/eval/src/value/string.rs b/tvix/eval/src/value/string.rs index 47661e03a..1937a3587 100644 --- a/tvix/eval/src/value/string.rs +++ b/tvix/eval/src/value/string.rs @@ -3,7 +3,7 @@ use std::fmt::Display; /// This module implements Nix language strings and their different /// backing implementations. -#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, Debug, Hash, Eq, Ord)] pub enum NixString { Static(&'static str), Heap(String), @@ -18,6 +18,18 @@ impl Display for NixString { } } +impl PartialEq for NixString { + fn eq(&self, other: &Self) -> bool { + self.as_str() == other.as_str() + } +} + +impl PartialOrd for NixString { + fn partial_cmp(&self, other: &Self) -> Option { + self.as_str().partial_cmp(other.as_str()) + } +} + impl From<&'static str> for NixString { fn from(s: &'static str) -> Self { NixString::Static(s)