From 2b026d9759f297de61b0d5ec5624ce6ccd773b5c Mon Sep 17 00:00:00 2001 From: Gary Coady Date: Wed, 24 Jul 2024 04:42:20 +0200 Subject: [PATCH] Fix PartialEq for Value in opentelemetry-stdout (#1955) Co-authored-by: Lalit Kumar Bhasin --- opentelemetry-stdout/src/common.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/opentelemetry-stdout/src/common.rs b/opentelemetry-stdout/src/common.rs index bd6f178969..bbf7f86251 100644 --- a/opentelemetry-stdout/src/common.rs +++ b/opentelemetry-stdout/src/common.rs @@ -86,9 +86,21 @@ pub(crate) enum Value { impl PartialEq for Value { fn eq(&self, other: &Self) -> bool { - match (&self, &other) { + match (self, other) { + (Value::Bool(b), Value::Bool(ob)) => b.eq(ob), + (Value::Int(i), Value::Int(oi)) => i.eq(oi), (Value::Double(f), Value::Double(of)) => OrderedFloat(*f).eq(&OrderedFloat(*of)), - (non_double, other_non_double) => non_double.eq(other_non_double), + (Value::String(s), Value::String(os)) => s.eq(os), + (Value::Array(a), Value::Array(oa)) => a.eq(oa), + (Value::KeyValues(kv), Value::KeyValues(okv)) => kv.eq(okv), + (Value::BytesValue(b), Value::BytesValue(ob)) => b.eq(ob), + (Value::Bool(_), _) => false, + (Value::Int(_), _) => false, + (Value::Double(_), _) => false, + (Value::String(_), _) => false, + (Value::Array(_), _) => false, + (Value::KeyValues(_), _) => false, + (Value::BytesValue(_), _) => false, } } }