From 1c3751410ff8f21081e9e4622034cdeffd1d77f9 Mon Sep 17 00:00:00 2001 From: Andrew Gazelka Date: Tue, 28 May 2024 12:31:06 -0500 Subject: [PATCH] fix clippy lints (#137) --- derive/src/traits.rs | 7 ++++++- src/checked.rs | 5 +---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/derive/src/traits.rs b/derive/src/traits.rs index 73329f0..abe27f1 100644 --- a/derive/src/traits.rs +++ b/derive/src/traits.rs @@ -407,7 +407,11 @@ impl Derivable for Contiguous { quote!(), quote! { type Int = #integer_ty; + + #![allow(clippy::missing_docs_in_private_items)] const MIN_VALUE: #integer_ty = #min_lit; + + #![allow(clippy::missing_docs_in_private_items)] const MAX_VALUE: #integer_ty = #max_lit; #[inline] @@ -491,6 +495,7 @@ fn generate_checked_bit_pattern_struct( #repr #[derive(Clone, Copy, #crate_name::AnyBitPattern)] #derive_dbg + #[allow(missing_docs)] pub struct #bits_ty { #(#field_name: <#field_ty as #crate_name::CheckedBitPattern>::Bits,)* } @@ -499,7 +504,7 @@ fn generate_checked_bit_pattern_struct( type Bits = #bits_ty; #[inline] - #[allow(clippy::double_comparisons)] + #[allow(clippy::double_comparisons, unused)] fn is_valid_bit_pattern(bits: &#bits_ty) -> bool { #(<#field_ty as #crate_name::CheckedBitPattern>::is_valid_bit_pattern(&{ bits.#field_name }) && )* true } diff --git a/src/checked.rs b/src/checked.rs index ae45823..cc65869 100644 --- a/src/checked.rs +++ b/src/checked.rs @@ -163,10 +163,7 @@ unsafe impl CheckedBitPattern for bool { #[inline] fn is_valid_bit_pattern(bits: &Self::Bits) -> bool { - match *bits { - 0 | 1 => true, - _ => false, - } + matches!(*bits, 0 | 1) } }