From 03d4b8ff346e8582632388c4112585d5cf714a0a Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Fri, 19 Apr 2024 10:02:34 +0200 Subject: [PATCH] fix Variant Eq implementation Closes #34 --- rust/src/util.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rust/src/util.rs b/rust/src/util.rs index 2b18bda..1323eae 100644 --- a/rust/src/util.rs +++ b/rust/src/util.rs @@ -82,7 +82,7 @@ impl Display for Sizing { } } -#[derive(Clone, PartialEq, Eq, Hash, Debug)] +#[derive(Clone, Eq, Hash, Debug)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate = "serde_crate"))] pub struct Variant { pub name: VariantName, @@ -107,6 +107,12 @@ impl Variant { } } +impl PartialEq for Variant { + fn eq(&self, other: &Self) -> bool { + self.tag == other.tag || self.name == other.name + } +} + impl PartialOrd for Variant { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } }