Skip to content

Commit

Permalink
Annotate metric types with must_use
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde committed Apr 24, 2024
1 parent 65f6e65 commit 5f23138
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions metrics/src/handles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,21 @@ pub trait HistogramFn {

/// A counter.
#[derive(Clone)]
#[must_use = "counters do nothing unless you use them"]
pub struct Counter {
inner: Option<Arc<dyn CounterFn + Send + Sync>>,
}

/// A gauge.
#[derive(Clone)]
#[must_use = "gauges do nothing unless you use them"]
pub struct Gauge {
inner: Option<Arc<dyn GaugeFn + Send + Sync>>,
}

/// A histogram.
#[derive(Clone)]
#[must_use = "histograms do nothing unless you use them"]
pub struct Histogram {
inner: Option<Arc<dyn HistogramFn + Send + Sync>>,
}
Expand Down

0 comments on commit 5f23138

Please sign in to comment.