@@ -1119,7 +1119,7 @@ macro_rules! nonzero_integer {
1119
1119
self . get( ) . checked_mul( other. get( ) ) . is_some( )
1120
1120
} ) ]
1121
1121
#[ ensures( |result: & Self | {
1122
- self . get( ) . checked_mul( other. get( ) ) . unwrap ( ) == result. get( )
1122
+ self . get( ) . checked_mul( other. get( ) ) . is_some_and ( |product| product == result. get( ) )
1123
1123
} ) ]
1124
1124
pub const unsafe fn unchecked_mul( self , other: Self ) -> Self {
1125
1125
// SAFETY: The caller ensures there is no overflow.
@@ -1528,7 +1528,7 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
1528
1528
} ) ]
1529
1529
#[ ensures( |result: & Self | {
1530
1530
// Postcondition: the result matches the expected addition
1531
- self . get( ) . checked_add( other) . unwrap ( ) == result. get( )
1531
+ self . get( ) . checked_add( other) . is_some_and ( |sum| sum == result. get( ) )
1532
1532
} ) ]
1533
1533
pub const unsafe fn unchecked_add( self , other: $Int) -> Self {
1534
1534
// SAFETY: The caller ensures there is no overflow.
@@ -2870,8 +2870,6 @@ mod verify {
2870
2870
check_mul_unchecked_small ! ( u8 , NonZeroU8 , nonzero_check_mul_for_u8) ;
2871
2871
check_mul_unchecked_small ! ( u16 , NonZeroU16 , nonzero_check_mul_for_u16) ;
2872
2872
2873
- //check_mul_unchecked_large!(i16, NonZeroU16, nonzero_check_mul_for_u16);
2874
-
2875
2873
macro_rules! nonzero_check_add {
2876
2874
( $t: ty, $nonzero_type: ty, $nonzero_check_unchecked_add_for: ident) => {
2877
2875
#[ kani:: proof_for_contract( <$t>:: unchecked_add) ]
@@ -2886,13 +2884,6 @@ mod verify {
2886
2884
} ;
2887
2885
}
2888
2886
2889
- // Generate proofs for all NonZero types
2890
- // nonzero_check_add!(i8, core::num::NonZeroI8, nonzero_check_unchecked_add_for_i8);
2891
- // nonzero_check_add!(i16, core::num::NonZeroI16, nonzero_check_unchecked_add_for_i16);
2892
- // nonzero_check_add!(i32, core::num::NonZeroI32, nonzero_check_unchecked_add_for_i32);
2893
- // nonzero_check_add!(i64, core::num::NonZeroI64, nonzero_check_unchecked_add_for_i64);
2894
- // nonzero_check_add!(i128, core::num::NonZeroI128, nonzero_check_unchecked_add_for_i128);
2895
- // nonzero_check_add!(isize, core::num::NonZeroIsize, nonzero_check_unchecked_add_for_isize);
2896
2887
nonzero_check_add ! ( u8 , core:: num:: NonZeroU8 , nonzero_check_unchecked_add_for_u8) ;
2897
2888
nonzero_check_add ! ( u16 , core:: num:: NonZeroU16 , nonzero_check_unchecked_add_for_u16) ;
2898
2889
nonzero_check_add ! ( u32 , core:: num:: NonZeroU32 , nonzero_check_unchecked_add_for_u32) ;
0 commit comments