From 8461fdbe2e4ff958b100a66c6b426e9c5979ba18 Mon Sep 17 00:00:00 2001 From: Lokathor Date: Tue, 28 May 2024 12:19:37 -0600 Subject: [PATCH] fix for 1.34 building. --- src/checked.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/checked.rs b/src/checked.rs index cc65869..9f55a6b 100644 --- a/src/checked.rs +++ b/src/checked.rs @@ -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) @@ -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, + } } }