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 2
2
3
3
#![ warn( rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros) ]
4
4
5
+ #[ cfg( feature = "tracking" ) ]
5
6
use std:: sync:: atomic:: AtomicUsize ;
6
7
7
8
/// Represents a struct used to enforce a numerical limit.
8
9
pub struct Limit {
9
10
upper_bound : usize ,
10
- #[ allow ( unused ) ]
11
+ #[ cfg ( feature = "tracking" ) ]
11
12
max : AtomicUsize ,
12
13
}
13
14
14
15
impl Limit {
15
16
/// Creates a new limit.
16
17
#[ inline]
17
18
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
+ }
19
24
}
20
25
21
26
/// Creates a new limit.
22
27
#[ inline]
23
28
#[ cfg( feature = "tracking" ) ]
24
29
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
+ }
26
35
}
27
36
28
37
/// Gets the underlying numeric limit.
You can’t perform that action at this time.
0 commit comments