Skip to content

Commit ada7819

Browse files
committed
Remove unnecessary auto trait implementations
1 parent 8d84a76 commit ada7819

File tree

2 files changed

+1
-36
lines changed
  • opentelemetry-sdk/src/metrics
  • opentelemetry/src/metrics

2 files changed

+1
-36
lines changed

opentelemetry-sdk/src/metrics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn calculate_hash(values: &[KeyValue]) -> u64 {
104104

105105
impl AttributeSet {
106106
fn new(mut values: Vec<KeyValue>) -> Self {
107-
values.sort_unstable();
107+
values.sort_unstable_by(|a, b| a.key.cmp(&b.key));
108108
let hash = calculate_hash(&values);
109109
AttributeSet(values, hash)
110110
}

opentelemetry/src/metrics/mod.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! # OpenTelemetry Metrics API
22
3-
use std::cmp::Ordering;
43
use std::hash::{Hash, Hasher};
54
use std::result;
65
use std::sync::Arc;
@@ -91,19 +90,6 @@ impl Hash for KeyValue {
9190
}
9291
}
9392

94-
impl PartialOrd for KeyValue {
95-
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
96-
Some(self.cmp(other))
97-
}
98-
}
99-
100-
/// Ordering is based on the key only.
101-
impl Ord for KeyValue {
102-
fn cmp(&self, other: &Self) -> Ordering {
103-
self.key.cmp(&other.key)
104-
}
105-
}
106-
10793
impl Eq for KeyValue {}
10894

10995
/// SDK implemented trait for creating instruments
@@ -300,27 +286,6 @@ mod tests {
300286
}
301287
}
302288

303-
#[test]
304-
fn kv_float_order() {
305-
// TODO: Extend this test to all value types, not just F64
306-
let float_vals = [
307-
0.0,
308-
1.0,
309-
-1.0,
310-
f64::INFINITY,
311-
f64::NEG_INFINITY,
312-
f64::NAN,
313-
f64::MIN,
314-
f64::MAX,
315-
];
316-
317-
for v in float_vals {
318-
let kv1 = KeyValue::new("a", v);
319-
let kv2 = KeyValue::new("b", v);
320-
assert!(kv1 < kv2, "Order is solely based on key!");
321-
}
322-
}
323-
324289
fn hash_helper<T: Hash>(item: &T) -> u64 {
325290
let mut hasher = DefaultHasher::new();
326291
item.hash(&mut hasher);

0 commit comments

Comments
 (0)