fix clippy lints (#137)

This commit is contained in:
Andrew Gazelka 2024-05-28 12:31:06 -05:00 committed by GitHub
parent f9f7bb10b3
commit 1c3751410f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -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
}

View File

@ -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)
}
}