Skip to content

Commit

Permalink
fix for 1.34 building.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lokathor committed May 28, 2024
1 parent fef1c01 commit 8461fdb
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ use crate::{
///
/// # Safety
///
/// * `Self` *must* have the same layout as the specified `Bits` except for
/// the possible invalid bit patterns being checked during
/// [`is_valid_bit_pattern`].
/// * This almost certainly means your type must be `#[repr(C)]` or a similar
/// * `Self` *must* have the same layout as the specified `Bits` except for the
/// possible invalid bit patterns being checked during
/// [`is_valid_bit_pattern`].
/// * This almost certainly means your type must be `#[repr(C)]` or a similar
/// specified repr, but if you think you know better, you probably don't. If
/// you still think you know better, be careful and have fun. And don't mess
/// it up (I mean it).
/// you still think you know better, be careful and have fun. And don't mess
/// it up (I mean it).
/// * If [`is_valid_bit_pattern`] returns true, then the bit pattern contained
/// in `bits` must also be valid for an instance of `Self`.
/// * Probably more, don't mess it up (I mean it 2.0)
Expand Down Expand Up @@ -163,7 +163,10 @@ unsafe impl CheckedBitPattern for bool {

#[inline]
fn is_valid_bit_pattern(bits: &Self::Bits) -> bool {
matches!(*bits, 0 | 1)
match *bits {
0 | 1 => true,
_ => false,
}
}
}

Expand Down

0 comments on commit 8461fdb

Please sign in to comment.