Skip to content

Commit 1754913

Browse files
eduardosmAmanieu
authored andcommitted
Derive Default for Initializer in std_detect
1 parent 3bacbac commit 1754913

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

crates/std_detect/src/detect/cache.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,11 @@ const fn unset_bit(x: u64, bit: u32) -> u64 {
2929
const CACHE_CAPACITY: u32 = 62;
3030

3131
/// This type is used to initialize the cache
32-
#[derive(Copy, Clone)]
32+
// The derived `Default` implementation will initialize the field to zero,
33+
// which is what we want.
34+
#[derive(Copy, Clone, Default)]
3335
pub(crate) struct Initializer(u64);
3436

35-
#[allow(clippy::use_self)]
36-
impl Default for Initializer {
37-
fn default() -> Self {
38-
Initializer(0)
39-
}
40-
}
41-
4237
// NOTE: the `debug_assert!` would catch that we do not add more Features than
4338
// the one fitting our cache.
4439
impl Initializer {

0 commit comments

Comments
 (0)