From eaa729869492219f15f8219c3eb7577bfd0a9a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20S=C3=A1nchez=20Mu=C3=B1oz?= Date: Mon, 30 Oct 2023 13:19:11 +0100 Subject: [PATCH] Derive `Default` for `Initializer` in std_detect --- library/stdarch/crates/std_detect/src/detect/cache.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/library/stdarch/crates/std_detect/src/detect/cache.rs b/library/stdarch/crates/std_detect/src/detect/cache.rs index a94c655c3a97..64b2841bbf33 100644 --- a/library/stdarch/crates/std_detect/src/detect/cache.rs +++ b/library/stdarch/crates/std_detect/src/detect/cache.rs @@ -29,16 +29,11 @@ const fn unset_bit(x: u64, bit: u32) -> u64 { const CACHE_CAPACITY: u32 = 62; /// This type is used to initialize the cache -#[derive(Copy, Clone)] +// The derived `Default` implementation will initialize the field to zero, +// which is what we want. +#[derive(Copy, Clone, Default)] pub(crate) struct Initializer(u64); -#[allow(clippy::use_self)] -impl Default for Initializer { - fn default() -> Self { - Initializer(0) - } -} - // NOTE: the `debug_assert!` would catch that we do not add more Features than // the one fitting our cache. impl Initializer {