File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ macro_rules! impl_encoding_traits {
3030
3131 let bytes = reader. read_into( & mut buf[ ..max_length] ) ?;
3232
33+ // We actually want the conversion to overflow here
34+ #[ allow( clippy:: cast_possible_wrap) ]
3335 let result = if is_highest_bit_set( bytes) {
3436 <$uint>:: from_be_bytes( decode_to_array( bytes) ?) as $int
3537 } else {
@@ -48,6 +50,8 @@ macro_rules! impl_encoding_traits {
4850 impl EncodeValue for $int {
4951 fn value_len( & self ) -> Result <Length > {
5052 if * self < 0 {
53+ // We actually want the conversion to overflow here
54+ #[ allow( clippy:: cast_sign_loss) ]
5155 negative_encoded_len( & ( * self as $uint) . to_be_bytes( ) )
5256 } else {
5357 uint:: encoded_len( & self . to_be_bytes( ) )
@@ -56,6 +60,8 @@ macro_rules! impl_encoding_traits {
5660
5761 fn encode_value( & self , writer: & mut impl Writer ) -> Result <( ) > {
5862 if * self < 0 {
63+ // We actually want the conversion to overflow here
64+ #[ allow( clippy:: cast_sign_loss) ]
5965 encode_bytes( writer, & ( * self as $uint) . to_be_bytes( ) )
6066 } else {
6167 uint:: encode_bytes( writer, & self . to_be_bytes( ) )
You can’t perform that action at this time.
0 commit comments