File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 22
33#![ warn( rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros) ]
44
5+ #[ cfg( feature = "tracking" ) ]
56use std:: sync:: atomic:: AtomicUsize ;
67
78/// Represents a struct used to enforce a numerical limit.
89pub struct Limit {
910 upper_bound : usize ,
10- #[ allow ( unused ) ]
11+ #[ cfg ( feature = "tracking" ) ]
1112 max : AtomicUsize ,
1213}
1314
1415impl Limit {
1516 /// Creates a new limit.
1617 #[ inline]
1718 pub const fn new ( upper_bound : usize ) -> Self {
18- Self { upper_bound, max : AtomicUsize :: new ( 0 ) }
19+ Self {
20+ upper_bound,
21+ #[ cfg( feature = "tracking" ) ]
22+ max : AtomicUsize :: new ( 0 ) ,
23+ }
1924 }
2025
2126 /// Creates a new limit.
2227 #[ inline]
2328 #[ cfg( feature = "tracking" ) ]
2429 pub const fn new_tracking ( upper_bound : usize ) -> Self {
25- Self { upper_bound, max : AtomicUsize :: new ( 1 ) }
30+ Self {
31+ upper_bound,
32+ #[ cfg( feature = "tracking" ) ]
33+ max : AtomicUsize :: new ( 1 ) ,
34+ }
2635 }
2736
2837 /// Gets the underlying numeric limit.
You can’t perform that action at this time.
0 commit comments