@@ -7,226 +7,238 @@ LL | ptr as *const T
77 = note: `-D clippy::unnecessary-cast` implied by `-D warnings`
88
99error: casting integer literal to `i32` is unnecessary
10- --> $DIR/unnecessary_cast.rs:44 :5
10+ --> $DIR/unnecessary_cast.rs:54 :5
1111 |
1212LL | 1i32 as i32;
1313 | ^^^^^^^^^^^ help: try: `1_i32`
1414
1515error: casting float literal to `f32` is unnecessary
16- --> $DIR/unnecessary_cast.rs:45 :5
16+ --> $DIR/unnecessary_cast.rs:55 :5
1717 |
1818LL | 1f32 as f32;
1919 | ^^^^^^^^^^^ help: try: `1_f32`
2020
2121error: casting to the same type is unnecessary (`bool` -> `bool`)
22- --> $DIR/unnecessary_cast.rs:46 :5
22+ --> $DIR/unnecessary_cast.rs:56 :5
2323 |
2424LL | false as bool;
2525 | ^^^^^^^^^^^^^ help: try: `false`
2626
2727error: casting integer literal to `i32` is unnecessary
28- --> $DIR/unnecessary_cast.rs:49 :5
28+ --> $DIR/unnecessary_cast.rs:59 :5
2929 |
3030LL | -1_i32 as i32;
3131 | ^^^^^^^^^^^^^ help: try: `-1_i32`
3232
3333error: casting integer literal to `i32` is unnecessary
34- --> $DIR/unnecessary_cast.rs:50 :5
34+ --> $DIR/unnecessary_cast.rs:60 :5
3535 |
3636LL | - 1_i32 as i32;
3737 | ^^^^^^^^^^^^^^ help: try: `- 1_i32`
3838
3939error: casting float literal to `f32` is unnecessary
40- --> $DIR/unnecessary_cast.rs:51 :5
40+ --> $DIR/unnecessary_cast.rs:61 :5
4141 |
4242LL | -1f32 as f32;
4343 | ^^^^^^^^^^^^ help: try: `-1_f32`
4444
4545error: casting integer literal to `i32` is unnecessary
46- --> $DIR/unnecessary_cast.rs:52 :5
46+ --> $DIR/unnecessary_cast.rs:62 :5
4747 |
4848LL | 1_i32 as i32;
4949 | ^^^^^^^^^^^^ help: try: `1_i32`
5050
5151error: casting float literal to `f32` is unnecessary
52- --> $DIR/unnecessary_cast.rs:53 :5
52+ --> $DIR/unnecessary_cast.rs:63 :5
5353 |
5454LL | 1_f32 as f32;
5555 | ^^^^^^^^^^^^ help: try: `1_f32`
5656
5757error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
58- --> $DIR/unnecessary_cast.rs:55 :22
58+ --> $DIR/unnecessary_cast.rs:65 :22
5959 |
6060LL | let _: *mut u8 = [1u8, 2].as_ptr() as *const u8 as *mut u8;
6161 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_ptr()`
6262
6363error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
64- --> $DIR/unnecessary_cast.rs:57 :5
64+ --> $DIR/unnecessary_cast.rs:67 :5
6565 |
6666LL | [1u8, 2].as_ptr() as *const u8;
6767 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_ptr()`
6868
6969error: casting raw pointers to the same type and constness is unnecessary (`*mut u8` -> `*mut u8`)
70- --> $DIR/unnecessary_cast.rs:59 :5
70+ --> $DIR/unnecessary_cast.rs:69 :5
7171 |
7272LL | [1u8, 2].as_mut_ptr() as *mut u8;
7373 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_mut_ptr()`
7474
7575error: casting raw pointers to the same type and constness is unnecessary (`*const u32` -> `*const u32`)
76- --> $DIR/unnecessary_cast.rs:70 :5
76+ --> $DIR/unnecessary_cast.rs:80 :5
7777 |
7878LL | owo::<u32>([1u32].as_ptr()) as *const u32;
7979 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `owo::<u32>([1u32].as_ptr())`
8080
8181error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
82- --> $DIR/unnecessary_cast.rs:71 :5
82+ --> $DIR/unnecessary_cast.rs:81 :5
8383 |
8484LL | uwu::<u32, u8>([1u32].as_ptr()) as *const u8;
8585 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::<u32, u8>([1u32].as_ptr())`
8686
8787error: casting raw pointers to the same type and constness is unnecessary (`*const u32` -> `*const u32`)
88- --> $DIR/unnecessary_cast.rs:73 :5
88+ --> $DIR/unnecessary_cast.rs:83 :5
8989 |
9090LL | uwu::<u32, u32>([1u32].as_ptr()) as *const u32;
9191 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::<u32, u32>([1u32].as_ptr())`
9292
93+ error: casting to the same type is unnecessary (`u32` -> `u32`)
94+ --> $DIR/unnecessary_cast.rs:118:5
95+ |
96+ LL | aaa() as u32;
97+ | ^^^^^^^^^^^^ help: try: `aaa()`
98+
99+ error: casting to the same type is unnecessary (`u32` -> `u32`)
100+ --> $DIR/unnecessary_cast.rs:120:5
101+ |
102+ LL | aaa() as u32;
103+ | ^^^^^^^^^^^^ help: try: `aaa()`
104+
93105error: casting integer literal to `f32` is unnecessary
94- --> $DIR/unnecessary_cast.rs:139 :9
106+ --> $DIR/unnecessary_cast.rs:156 :9
95107 |
96108LL | 100 as f32;
97109 | ^^^^^^^^^^ help: try: `100_f32`
98110
99111error: casting integer literal to `f64` is unnecessary
100- --> $DIR/unnecessary_cast.rs:140 :9
112+ --> $DIR/unnecessary_cast.rs:157 :9
101113 |
102114LL | 100 as f64;
103115 | ^^^^^^^^^^ help: try: `100_f64`
104116
105117error: casting integer literal to `f64` is unnecessary
106- --> $DIR/unnecessary_cast.rs:141 :9
118+ --> $DIR/unnecessary_cast.rs:158 :9
107119 |
108120LL | 100_i32 as f64;
109121 | ^^^^^^^^^^^^^^ help: try: `100_f64`
110122
111123error: casting integer literal to `f32` is unnecessary
112- --> $DIR/unnecessary_cast.rs:142 :17
124+ --> $DIR/unnecessary_cast.rs:159 :17
113125 |
114126LL | let _ = -100 as f32;
115127 | ^^^^^^^^^^^ help: try: `-100_f32`
116128
117129error: casting integer literal to `f64` is unnecessary
118- --> $DIR/unnecessary_cast.rs:143 :17
130+ --> $DIR/unnecessary_cast.rs:160 :17
119131 |
120132LL | let _ = -100 as f64;
121133 | ^^^^^^^^^^^ help: try: `-100_f64`
122134
123135error: casting integer literal to `f64` is unnecessary
124- --> $DIR/unnecessary_cast.rs:144 :17
136+ --> $DIR/unnecessary_cast.rs:161 :17
125137 |
126138LL | let _ = -100_i32 as f64;
127139 | ^^^^^^^^^^^^^^^ help: try: `-100_f64`
128140
129141error: casting float literal to `f32` is unnecessary
130- --> $DIR/unnecessary_cast.rs:145 :9
142+ --> $DIR/unnecessary_cast.rs:162 :9
131143 |
132144LL | 100. as f32;
133145 | ^^^^^^^^^^^ help: try: `100_f32`
134146
135147error: casting float literal to `f64` is unnecessary
136- --> $DIR/unnecessary_cast.rs:146 :9
148+ --> $DIR/unnecessary_cast.rs:163 :9
137149 |
138150LL | 100. as f64;
139151 | ^^^^^^^^^^^ help: try: `100_f64`
140152
141153error: casting integer literal to `u32` is unnecessary
142- --> $DIR/unnecessary_cast.rs:158 :9
154+ --> $DIR/unnecessary_cast.rs:175 :9
143155 |
144156LL | 1 as u32;
145157 | ^^^^^^^^ help: try: `1_u32`
146158
147159error: casting integer literal to `i32` is unnecessary
148- --> $DIR/unnecessary_cast.rs:159 :9
160+ --> $DIR/unnecessary_cast.rs:176 :9
149161 |
150162LL | 0x10 as i32;
151163 | ^^^^^^^^^^^ help: try: `0x10_i32`
152164
153165error: casting integer literal to `usize` is unnecessary
154- --> $DIR/unnecessary_cast.rs:160 :9
166+ --> $DIR/unnecessary_cast.rs:177 :9
155167 |
156168LL | 0b10 as usize;
157169 | ^^^^^^^^^^^^^ help: try: `0b10_usize`
158170
159171error: casting integer literal to `u16` is unnecessary
160- --> $DIR/unnecessary_cast.rs:161 :9
172+ --> $DIR/unnecessary_cast.rs:178 :9
161173 |
162174LL | 0o73 as u16;
163175 | ^^^^^^^^^^^ help: try: `0o73_u16`
164176
165177error: casting integer literal to `u32` is unnecessary
166- --> $DIR/unnecessary_cast.rs:162 :9
178+ --> $DIR/unnecessary_cast.rs:179 :9
167179 |
168180LL | 1_000_000_000 as u32;
169181 | ^^^^^^^^^^^^^^^^^^^^ help: try: `1_000_000_000_u32`
170182
171183error: casting float literal to `f64` is unnecessary
172- --> $DIR/unnecessary_cast.rs:164 :9
184+ --> $DIR/unnecessary_cast.rs:181 :9
173185 |
174186LL | 1.0 as f64;
175187 | ^^^^^^^^^^ help: try: `1.0_f64`
176188
177189error: casting float literal to `f32` is unnecessary
178- --> $DIR/unnecessary_cast.rs:165 :9
190+ --> $DIR/unnecessary_cast.rs:182 :9
179191 |
180192LL | 0.5 as f32;
181193 | ^^^^^^^^^^ help: try: `0.5_f32`
182194
183195error: casting integer literal to `i32` is unnecessary
184- --> $DIR/unnecessary_cast.rs:169 :17
196+ --> $DIR/unnecessary_cast.rs:186 :17
185197 |
186198LL | let _ = -1 as i32;
187199 | ^^^^^^^^^ help: try: `-1_i32`
188200
189201error: casting float literal to `f32` is unnecessary
190- --> $DIR/unnecessary_cast.rs:170 :17
202+ --> $DIR/unnecessary_cast.rs:187 :17
191203 |
192204LL | let _ = -1.0 as f32;
193205 | ^^^^^^^^^^^ help: try: `-1.0_f32`
194206
195207error: casting to the same type is unnecessary (`i32` -> `i32`)
196- --> $DIR/unnecessary_cast.rs:176 :18
208+ --> $DIR/unnecessary_cast.rs:193 :18
197209 |
198210LL | let _ = &(x as i32);
199211 | ^^^^^^^^^^ help: try: `{ x }`
200212
201213error: casting integer literal to `i32` is unnecessary
202- --> $DIR/unnecessary_cast.rs:182 :22
214+ --> $DIR/unnecessary_cast.rs:199 :22
203215 |
204216LL | let _: i32 = -(1) as i32;
205217 | ^^^^^^^^^^^ help: try: `-1_i32`
206218
207219error: casting integer literal to `i64` is unnecessary
208- --> $DIR/unnecessary_cast.rs:184 :22
220+ --> $DIR/unnecessary_cast.rs:201 :22
209221 |
210222LL | let _: i64 = -(1) as i64;
211223 | ^^^^^^^^^^^ help: try: `-1_i64`
212224
213225error: casting float literal to `f64` is unnecessary
214- --> $DIR/unnecessary_cast.rs:191 :22
226+ --> $DIR/unnecessary_cast.rs:208 :22
215227 |
216228LL | let _: f64 = (-8.0 as f64).exp();
217229 | ^^^^^^^^^^^^^ help: try: `(-8.0_f64)`
218230
219231error: casting float literal to `f64` is unnecessary
220- --> $DIR/unnecessary_cast.rs:193 :23
232+ --> $DIR/unnecessary_cast.rs:210 :23
221233 |
222234LL | let _: f64 = -(8.0 as f64).exp(); // should suggest `-8.0_f64.exp()` here not to change code behavior
223235 | ^^^^^^^^^^^^ help: try: `8.0_f64`
224236
225237error: casting to the same type is unnecessary (`f32` -> `f32`)
226- --> $DIR/unnecessary_cast.rs:201 :20
238+ --> $DIR/unnecessary_cast.rs:218 :20
227239 |
228240LL | let _num = foo() as f32;
229241 | ^^^^^^^^^^^^ help: try: `foo()`
230242
231- error: aborting due to 38 previous errors
243+ error: aborting due to 40 previous errors
232244
0 commit comments