@@ -1119,7 +1119,7 @@ macro_rules! nonzero_integer {
11191119 self . get( ) . checked_mul( other. get( ) ) . is_some( )
11201120 } ) ]
11211121 #[ 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( ) )
11231123 } ) ]
11241124 pub const unsafe fn unchecked_mul( self , other: Self ) -> Self {
11251125 // SAFETY: The caller ensures there is no overflow.
@@ -1528,7 +1528,7 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
15281528 } ) ]
15291529 #[ ensures( |result: & Self | {
15301530 // 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( ) )
15321532 } ) ]
15331533 pub const unsafe fn unchecked_add( self , other: $Int) -> Self {
15341534 // SAFETY: The caller ensures there is no overflow.
@@ -2870,8 +2870,6 @@ mod verify {
28702870 check_mul_unchecked_small ! ( u8 , NonZeroU8 , nonzero_check_mul_for_u8) ;
28712871 check_mul_unchecked_small ! ( u16 , NonZeroU16 , nonzero_check_mul_for_u16) ;
28722872
2873- //check_mul_unchecked_large!(i16, NonZeroU16, nonzero_check_mul_for_u16);
2874-
28752873 macro_rules! nonzero_check_add {
28762874 ( $t: ty, $nonzero_type: ty, $nonzero_check_unchecked_add_for: ident) => {
28772875 #[ kani:: proof_for_contract( <$t>:: unchecked_add) ]
@@ -2886,13 +2884,6 @@ mod verify {
28862884 } ;
28872885 }
28882886
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);
28962887 nonzero_check_add ! ( u8 , core:: num:: NonZeroU8 , nonzero_check_unchecked_add_for_u8) ;
28972888 nonzero_check_add ! ( u16 , core:: num:: NonZeroU16 , nonzero_check_unchecked_add_for_u16) ;
28982889 nonzero_check_add ! ( u32 , core:: num:: NonZeroU32 , nonzero_check_unchecked_add_for_u32) ;
0 commit comments