From b20cb6bc826f8e039430b52af0f13a736ca44af7 Mon Sep 17 00:00:00 2001 From: Lucas Kent Date: Sat, 23 Dec 2023 06:53:38 +1100 Subject: [PATCH] Remove unneeded unsafe from test (#427) --- metrics-exporter-prometheus/src/distribution.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/metrics-exporter-prometheus/src/distribution.rs b/metrics-exporter-prometheus/src/distribution.rs index a9944305..335d7172 100644 --- a/metrics-exporter-prometheus/src/distribution.rs +++ b/metrics-exporter-prometheus/src/distribution.rs @@ -353,10 +353,10 @@ mod tests { let (clock, mock) = Clock::mock(); mock.increment(Duration::from_secs(4)); - const BUCKET_COUNT: NonZeroU32 = unsafe { NonZeroU32::new_unchecked(2) }; - const BUCKET_WIDTH: Duration = Duration::from_secs(5); + let bucket_count = NonZeroU32::new(2).unwrap(); + let bucket_width = Duration::from_secs(5); - let mut summary = RollingSummary::new(BUCKET_COUNT, BUCKET_WIDTH); + let mut summary = RollingSummary::new(bucket_count, bucket_width); assert_eq!(0, summary.buckets().len()); assert_eq!(0, summary.count());