From d0e1e71bff39bc454faf3e7845695494d2eb3695 Mon Sep 17 00:00:00 2001 From: Oliver Gould Date: Tue, 14 Aug 2018 12:43:18 -0700 Subject: [PATCH] Relax Metric::fmt_scopes' type bounds (#64) 005d4f1 made `Metric::fmt_scopes` generic over an Iterator, but maintained some of the unnecessary type bounds inherited from its initial implementation. This change relaxes the constraints on the label value so that it need not be passed as a reference or be hashable--our only requirement is that it can be rendered. --- src/telemetry/metrics/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/telemetry/metrics/mod.rs b/src/telemetry/metrics/mod.rs index a1e4cb986..d660c70b5 100644 --- a/src/telemetry/metrics/mod.rs +++ b/src/telemetry/metrics/mod.rs @@ -28,7 +28,6 @@ //! end of the label set (all of which will make Prometheus angry). use std::default::Default; use std::fmt::{self, Display}; -use std::hash::Hash; use std::marker::PhantomData; use std::sync::{Arc, Mutex}; use std::time::{Duration, Instant}; @@ -134,15 +133,15 @@ impl<'a, M: FmtMetric> Metric<'a, M> { } /// Formats a single metric across labeled scopes. - pub fn fmt_scopes<'i, L: 'i, S: 'i, I, F>( + pub fn fmt_scopes<'s, L, S: 's, I, F>( &self, f: &mut fmt::Formatter, scopes: I, to_metric: F ) -> fmt::Result where - L: Display + Hash + Eq, - I: IntoIterator, + L: Display, + I: IntoIterator, F: Fn(&S) -> &M { for (labels, scope) in scopes { @@ -166,7 +165,6 @@ impl Root { fn request(&mut self, labels: RequestLabels) -> &mut http::RequestMetrics { self.requests.get_or_default(labels).stamped() - } fn response(&mut self, labels: ResponseLabels) -> &mut http::ResponseMetrics {