File tree 2 files changed +157
-100
lines changed
2 files changed +157
-100
lines changed Original file line number Diff line number Diff line change 1
1
//@no-rustfix
2
2
3
3
#![ feature( repr128) ]
4
+ #![ feature( isqrt) ]
4
5
#![ allow( incomplete_features) ]
5
6
#![ warn(
6
7
clippy:: cast_precision_loss,
@@ -149,8 +150,8 @@ fn main() {
149
150
( -1isize ) . checked_isqrt ( ) . expect ( "-1 is a small number" ) as usize ;
150
151
151
152
( -1i8 ) . rem_euclid ( 1i8 ) as u8 ;
152
- ( -1i8 ) . wrapping_rem_euclid ( 1i8 ) . unwrap ( ) as u16 ;
153
- ( -1i16 ) . rem_euclid ( 1i16 ) . unwrap ( ) as u16 ;
153
+ ( -1i8 ) . wrapping_rem_euclid ( 1i8 ) as u16 ;
154
+ ( -1i16 ) . rem_euclid ( 1i16 ) as u16 ;
154
155
( -1i16 ) . rem_euclid ( 1i16 ) as u32 ;
155
156
( -1i32 ) . rem_euclid ( 1i32 ) as u32 ;
156
157
( -1i32 ) . rem_euclid ( 1i32 ) as u64 ;
@@ -400,11 +401,11 @@ fn issue11642() {
400
401
( -2_i32 ) . pow ( 3 ) as u32 ;
401
402
//~^ ERROR: casting `i32` to `u32` may lose the sign of the value
402
403
403
- ( 2_i32 % 1 ) as u32 ;
404
- ( 2_i32 % -1 ) as u32 ;
405
- ( -2_i32 % 1 ) as u32 ;
404
+ ( 3_i32 % 2 ) as u32 ;
405
+ ( 3_i32 % -2 ) as u32 ;
406
+ ( -5_i32 % 2 ) as u32 ;
406
407
//~^ ERROR: casting `i32` to `u32` may lose the sign of the value
407
- ( -2_i32 % -1 ) as u32 ;
408
+ ( -5_i32 % -2 ) as u32 ;
408
409
//~^ ERROR: casting `i32` to `u32` may lose the sign of the value
409
410
( 2_i32 >> 1 ) as u32 ;
410
411
( -2_i32 >> 1 ) as u32 ;
You can’t perform that action at this time.
0 commit comments