From 0f04f9ce46b798d1bd120bb3de6c02c4dbd04591 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Thu, 23 Apr 2026 18:30:45 +0200 Subject: [PATCH] fix: resolve clippy warnings for newer Rust versions - Mark testutils module as #[cfg(test)] since it's only used in tests - Add explicit lifetime annotations to MetricTag::new and Metric::tags_iter to satisfy the mismatched_lifetime_syntaxes lint Co-Authored-By: Claude Opus 4.5 --- src/lib.rs | 1 + src/types.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a2b0703..5486e53 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,5 +3,6 @@ pub mod cadence; pub mod config; pub mod middleware; +#[cfg(test)] mod testutils; pub mod types; diff --git a/src/types.rs b/src/types.rs index 91f33a6..cc3285d 100644 --- a/src/types.rs +++ b/src/types.rs @@ -40,7 +40,7 @@ pub struct MetricTag<'a> { } impl MetricTag<'_> { - pub fn new(bytes: &[u8]) -> MetricTag { + pub fn new(bytes: &[u8]) -> MetricTag<'_> { MetricTag { raw: bytes, name_value_sep_pos: bytes.iter().position(|&b| b == b':'), @@ -135,7 +135,7 @@ impl Metric { self.tags_pos.map(|(i, j)| &self.raw[i..j]) } - pub fn tags_iter(&self) -> MetricTagIterator { + pub fn tags_iter(&self) -> MetricTagIterator<'_> { MetricTagIterator { remaining_tags: self.tags(), }