@@ -91,10 +91,6 @@ unsafe impl bytemuck::checked::CheckedBitPattern for ImageFormat {
9191 type Bits = u8 ;
9292
9393 fn is_valid_bit_pattern ( bits : & u8 ) -> bool {
94- #![ expect(
95- clippy:: absurd_extreme_comparisons,
96- reason = "There is only one value."
97- ) ]
9894 use bytemuck:: Contiguous ;
9995 // Don't need to compare against MIN_VALUE as this is u8 and 0 is the MIN_VALUE.
10096 * bits <= Self :: MAX_VALUE
@@ -106,7 +102,7 @@ unsafe impl bytemuck::checked::CheckedBitPattern for ImageFormat {
106102unsafe impl bytemuck:: Contiguous for ImageFormat {
107103 type Int = u8 ;
108104 const MIN_VALUE : u8 = Self :: Rgba8 as u8 ;
109- const MAX_VALUE : u8 = Self :: Rgba8 as u8 ;
105+ const MAX_VALUE : u8 = Self :: Bgra8 as u8 ;
110106}
111107
112108// Safety: The enum is `repr(u8)` and has only fieldless variants.
@@ -174,6 +170,10 @@ mod tests {
174170 Ok ( & ImageFormat :: Rgba8 ) ,
175171 try_from_bytes:: <ImageFormat >( valid_zero)
176172 ) ;
173+ assert_eq ! (
174+ Ok ( & ImageFormat :: Bgra8 ) ,
175+ try_from_bytes:: <ImageFormat >( valid_one)
176+ ) ;
177177 assert ! ( try_from_bytes:: <ImageFormat >( invalid) . is_err( ) ) ;
178178
179179 assert_eq ! (
@@ -283,10 +283,6 @@ mod tests {
283283 /// Tests that the [`Contiguous`] impl for [`ImageFormat`] is not trivially incorrect.
284284 const _: ( ) = {
285285 let mut value = 0 ;
286- #[ expect(
287- clippy:: absurd_extreme_comparisons,
288- reason = "There is only one value."
289- ) ]
290286 while value <= ImageFormat :: MAX_VALUE {
291287 // Safety: In a const context, therefore if this makes an invalid ImageFormat, that will be detected.
292288 let it: ImageFormat = unsafe { ptr:: read ( ( & raw const value) . cast ( ) ) } ;
0 commit comments