File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -40,18 +40,21 @@ pub trait HistogramFn {
40
40
41
41
/// A counter.
42
42
#[ derive( Clone ) ]
43
+ #[ must_use = "counters do nothing unless you use them" ]
43
44
pub struct Counter {
44
45
inner : Option < Arc < dyn CounterFn + Send + Sync > > ,
45
46
}
46
47
47
48
/// A gauge.
48
49
#[ derive( Clone ) ]
50
+ #[ must_use = "gauges do nothing unless you use them" ]
49
51
pub struct Gauge {
50
52
inner : Option < Arc < dyn GaugeFn + Send + Sync > > ,
51
53
}
52
54
53
55
/// A histogram.
54
56
#[ derive( Clone ) ]
57
+ #[ must_use = "histograms do nothing unless you use them" ]
55
58
pub struct Histogram {
56
59
inner : Option < Arc < dyn HistogramFn + Send + Sync > > ,
57
60
}
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ fn no_trailing_comma() {
12
12
13
13
#[ allow( dead_code) ]
14
14
fn with_trailing_comma ( ) {
15
- counter ! ( "qwe" , ) ;
15
+ counter ! ( "qwe" , ) . increment ( 1 ) ;
16
16
counter ! (
17
- "qwe" ,
17
+ "qwe" ,
18
18
"foo" => "bar" ,
19
19
) . increment ( 1 ) ;
20
20
counter ! ( "qwe" , vec![ ] , ) . increment ( 1 ) ;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ use framework::*; // This exposes mod `framework::metrics`.
13
13
14
14
#[ inline]
15
15
pub fn register_metrics ( ) {
16
- :: metrics:: counter!(
16
+ let _ = :: metrics:: counter!(
17
17
metrics:: UPLOAD_METRIC_NAME ,
18
18
& [
19
19
( metrics:: UPLOAD_METRIC_LABEL_PROCESS_TYPE , "" ) ,
You can’t perform that action at this time.
0 commit comments