Skip to content

Commit

Permalink
fix clippy lints (Lokathor#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgazelka authored and zachs18 committed Jun 6, 2024
1 parent 0ebbc7a commit 2d07496
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 1 addition & 4 deletions bytemuck/src/checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,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)
}
}

Expand Down
7 changes: 6 additions & 1 deletion bytemuck_derive/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,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]
Expand Down Expand Up @@ -526,6 +530,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,)*
}
Expand All @@ -534,7 +539,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
}
Expand Down

0 comments on commit 2d07496

Please sign in to comment.