2023-05-25 04:05:13 -05:00
|
|
|
error: casting raw pointers to the same type and constness is unnecessary (`*const T` -> `*const T`)
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:19:5
|
2023-05-25 04:05:13 -05:00
|
|
|
|
|
|
|
|
LL | ptr as *const T
|
|
|
|
| ^^^^^^^^^^^^^^^ help: try: `ptr`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::unnecessary-cast` implied by `-D warnings`
|
|
|
|
|
2021-03-13 18:09:08 -06:00
|
|
|
error: casting integer literal to `i32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:44:5
|
2019-08-04 01:24:23 -05:00
|
|
|
|
|
|
|
|
LL | 1i32 as i32;
|
2021-03-13 18:09:08 -06:00
|
|
|
| ^^^^^^^^^^^ help: try: `1_i32`
|
2019-08-04 01:24:23 -05:00
|
|
|
|
2021-03-13 18:09:08 -06:00
|
|
|
error: casting float literal to `f32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:45:5
|
2019-08-04 01:24:23 -05:00
|
|
|
|
|
|
|
|
LL | 1f32 as f32;
|
2021-03-13 18:09:08 -06:00
|
|
|
| ^^^^^^^^^^^ help: try: `1_f32`
|
2019-08-04 01:24:23 -05:00
|
|
|
|
|
|
|
error: casting to the same type is unnecessary (`bool` -> `bool`)
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:46:5
|
2019-08-04 01:24:23 -05:00
|
|
|
|
|
|
|
|
LL | false as bool;
|
2021-03-13 02:54:59 -06:00
|
|
|
| ^^^^^^^^^^^^^ help: try: `false`
|
2019-08-04 01:24:23 -05:00
|
|
|
|
2022-01-25 08:19:19 -06:00
|
|
|
error: casting integer literal to `i32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:49:5
|
2022-01-25 08:19:19 -06:00
|
|
|
|
|
|
|
|
LL | -1_i32 as i32;
|
|
|
|
| ^^^^^^^^^^^^^ help: try: `-1_i32`
|
|
|
|
|
|
|
|
error: casting integer literal to `i32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:50:5
|
2022-01-25 08:19:19 -06:00
|
|
|
|
|
|
|
|
LL | - 1_i32 as i32;
|
|
|
|
| ^^^^^^^^^^^^^^ help: try: `- 1_i32`
|
|
|
|
|
|
|
|
error: casting float literal to `f32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:51:5
|
2022-01-25 08:19:19 -06:00
|
|
|
|
|
|
|
|
LL | -1f32 as f32;
|
|
|
|
| ^^^^^^^^^^^^ help: try: `-1_f32`
|
|
|
|
|
|
|
|
error: casting integer literal to `i32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:52:5
|
2022-01-25 08:19:19 -06:00
|
|
|
|
|
|
|
|
LL | 1_i32 as i32;
|
|
|
|
| ^^^^^^^^^^^^ help: try: `1_i32`
|
|
|
|
|
|
|
|
error: casting float literal to `f32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:53:5
|
2022-01-25 08:19:19 -06:00
|
|
|
|
|
|
|
|
LL | 1_f32 as f32;
|
|
|
|
| ^^^^^^^^^^^^ help: try: `1_f32`
|
|
|
|
|
2023-05-24 10:53:31 -05:00
|
|
|
error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:55:22
|
2023-05-25 04:05:13 -05:00
|
|
|
|
|
|
|
|
LL | let _: *mut u8 = [1u8, 2].as_ptr() as *const u8 as *mut u8;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_ptr()`
|
|
|
|
|
|
|
|
error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:57:5
|
2023-05-24 10:53:31 -05:00
|
|
|
|
|
|
|
|
LL | [1u8, 2].as_ptr() as *const u8;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_ptr()`
|
|
|
|
|
|
|
|
error: casting raw pointers to the same type and constness is unnecessary (`*mut u8` -> `*mut u8`)
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:59:5
|
2023-05-24 10:53:31 -05:00
|
|
|
|
|
|
|
|
LL | [1u8, 2].as_mut_ptr() as *mut u8;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_mut_ptr()`
|
|
|
|
|
2023-05-25 04:05:13 -05:00
|
|
|
error: casting raw pointers to the same type and constness is unnecessary (`*const u32` -> `*const u32`)
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:70:5
|
2023-05-25 04:05:13 -05:00
|
|
|
|
|
|
|
|
LL | owo::<u32>([1u32].as_ptr()) as *const u32;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `owo::<u32>([1u32].as_ptr())`
|
|
|
|
|
|
|
|
error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:71:5
|
2023-05-25 04:05:13 -05:00
|
|
|
|
|
|
|
|
LL | uwu::<u32, u8>([1u32].as_ptr()) as *const u8;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::<u32, u8>([1u32].as_ptr())`
|
|
|
|
|
2023-05-25 04:17:36 -05:00
|
|
|
error: casting raw pointers to the same type and constness is unnecessary (`*const u32` -> `*const u32`)
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:73:5
|
2023-05-25 04:17:36 -05:00
|
|
|
|
|
|
|
|
LL | uwu::<u32, u32>([1u32].as_ptr()) as *const u32;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::<u32, u32>([1u32].as_ptr())`
|
|
|
|
|
2022-05-24 18:01:18 -05:00
|
|
|
error: casting integer literal to `f32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:139:9
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | 100 as f32;
|
|
|
|
| ^^^^^^^^^^ help: try: `100_f32`
|
|
|
|
|
|
|
|
error: casting integer literal to `f64` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:140:9
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | 100 as f64;
|
|
|
|
| ^^^^^^^^^^ help: try: `100_f64`
|
|
|
|
|
|
|
|
error: casting integer literal to `f64` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:141:9
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | 100_i32 as f64;
|
|
|
|
| ^^^^^^^^^^^^^^ help: try: `100_f64`
|
|
|
|
|
|
|
|
error: casting integer literal to `f32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:142:17
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | let _ = -100 as f32;
|
|
|
|
| ^^^^^^^^^^^ help: try: `-100_f32`
|
|
|
|
|
|
|
|
error: casting integer literal to `f64` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:143:17
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | let _ = -100 as f64;
|
|
|
|
| ^^^^^^^^^^^ help: try: `-100_f64`
|
|
|
|
|
|
|
|
error: casting integer literal to `f64` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:144:17
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | let _ = -100_i32 as f64;
|
|
|
|
| ^^^^^^^^^^^^^^^ help: try: `-100_f64`
|
|
|
|
|
|
|
|
error: casting float literal to `f32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:145:9
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | 100. as f32;
|
|
|
|
| ^^^^^^^^^^^ help: try: `100_f32`
|
|
|
|
|
|
|
|
error: casting float literal to `f64` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:146:9
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | 100. as f64;
|
|
|
|
| ^^^^^^^^^^^ help: try: `100_f64`
|
|
|
|
|
|
|
|
error: casting integer literal to `u32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:158:9
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | 1 as u32;
|
|
|
|
| ^^^^^^^^ help: try: `1_u32`
|
|
|
|
|
|
|
|
error: casting integer literal to `i32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:159:9
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | 0x10 as i32;
|
|
|
|
| ^^^^^^^^^^^ help: try: `0x10_i32`
|
|
|
|
|
|
|
|
error: casting integer literal to `usize` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:160:9
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | 0b10 as usize;
|
|
|
|
| ^^^^^^^^^^^^^ help: try: `0b10_usize`
|
|
|
|
|
|
|
|
error: casting integer literal to `u16` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:161:9
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | 0o73 as u16;
|
|
|
|
| ^^^^^^^^^^^ help: try: `0o73_u16`
|
|
|
|
|
|
|
|
error: casting integer literal to `u32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:162:9
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | 1_000_000_000 as u32;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try: `1_000_000_000_u32`
|
|
|
|
|
|
|
|
error: casting float literal to `f64` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:164:9
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | 1.0 as f64;
|
|
|
|
| ^^^^^^^^^^ help: try: `1.0_f64`
|
|
|
|
|
|
|
|
error: casting float literal to `f32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:165:9
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | 0.5 as f32;
|
|
|
|
| ^^^^^^^^^^ help: try: `0.5_f32`
|
|
|
|
|
|
|
|
error: casting integer literal to `i32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:169:17
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | let _ = -1 as i32;
|
|
|
|
| ^^^^^^^^^ help: try: `-1_i32`
|
|
|
|
|
|
|
|
error: casting float literal to `f32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:170:17
|
2022-05-24 18:01:18 -05:00
|
|
|
|
|
|
|
|
LL | let _ = -1.0 as f32;
|
|
|
|
| ^^^^^^^^^^^ help: try: `-1.0_f32`
|
|
|
|
|
2022-11-30 09:48:53 -06:00
|
|
|
error: casting to the same type is unnecessary (`i32` -> `i32`)
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:176:18
|
2022-11-30 09:48:53 -06:00
|
|
|
|
|
|
|
|
LL | let _ = &(x as i32);
|
|
|
|
| ^^^^^^^^^^ help: try: `{ x }`
|
|
|
|
|
2022-08-27 05:04:19 -05:00
|
|
|
error: casting integer literal to `i32` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:182:22
|
2022-08-27 05:04:19 -05:00
|
|
|
|
|
|
|
|
LL | let _: i32 = -(1) as i32;
|
|
|
|
| ^^^^^^^^^^^ help: try: `-1_i32`
|
|
|
|
|
|
|
|
error: casting integer literal to `i64` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:184:22
|
2022-08-27 05:04:19 -05:00
|
|
|
|
|
|
|
|
LL | let _: i64 = -(1) as i64;
|
|
|
|
| ^^^^^^^^^^^ help: try: `-1_i64`
|
|
|
|
|
2022-10-02 07:30:26 -05:00
|
|
|
error: casting float literal to `f64` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:191:22
|
2022-10-02 07:30:26 -05:00
|
|
|
|
|
|
|
|
LL | let _: f64 = (-8.0 as f64).exp();
|
|
|
|
| ^^^^^^^^^^^^^ help: try: `(-8.0_f64)`
|
|
|
|
|
|
|
|
error: casting float literal to `f64` is unnecessary
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:193:23
|
2022-10-02 07:30:26 -05:00
|
|
|
|
|
|
|
|
LL | let _: f64 = -(8.0 as f64).exp(); // should suggest `-8.0_f64.exp()` here not to change code behavior
|
|
|
|
| ^^^^^^^^^^^^ help: try: `8.0_f64`
|
|
|
|
|
2022-10-02 04:12:08 -05:00
|
|
|
error: casting to the same type is unnecessary (`f32` -> `f32`)
|
2023-06-13 06:51:56 -05:00
|
|
|
--> $DIR/unnecessary_cast.rs:201:20
|
2022-10-02 04:12:08 -05:00
|
|
|
|
|
|
|
|
LL | let _num = foo() as f32;
|
|
|
|
| ^^^^^^^^^^^^ help: try: `foo()`
|
|
|
|
|
2023-05-25 04:17:36 -05:00
|
|
|
error: aborting due to 38 previous errors
|
2019-08-04 01:24:23 -05:00
|
|
|
|