fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
7.8 KiB245 linesraw
1error: casting raw pointers to the same type and constness is unnecessary (`*const T` -> `*const T`)
2  --> $DIR/unnecessary_cast.rs:18:5
3   |
4LL |     ptr as *const T
5   |     ^^^^^^^^^^^^^^^ help: try: `ptr`
6   |
7   = note: `-D clippy::unnecessary-cast` implied by `-D warnings`
8   = help: to override `-D warnings` add `#[allow(clippy::unnecessary_cast)]`
9
10error: casting integer literal to `i32` is unnecessary
11  --> $DIR/unnecessary_cast.rs:53:5
12   |
13LL |     1i32 as i32;
14   |     ^^^^^^^^^^^ help: try: `1_i32`
15
16error: casting float literal to `f32` is unnecessary
17  --> $DIR/unnecessary_cast.rs:54:5
18   |
19LL |     1f32 as f32;
20   |     ^^^^^^^^^^^ help: try: `1_f32`
21
22error: casting to the same type is unnecessary (`bool` -> `bool`)
23  --> $DIR/unnecessary_cast.rs:55:5
24   |
25LL |     false as bool;
26   |     ^^^^^^^^^^^^^ help: try: `false`
27
28error: casting integer literal to `i32` is unnecessary
29  --> $DIR/unnecessary_cast.rs:58:5
30   |
31LL |     -1_i32 as i32;
32   |     ^^^^^^^^^^^^^ help: try: `-1_i32`
33
34error: casting integer literal to `i32` is unnecessary
35  --> $DIR/unnecessary_cast.rs:59:5
36   |
37LL |     - 1_i32 as i32;
38   |     ^^^^^^^^^^^^^^ help: try: `- 1_i32`
39
40error: casting float literal to `f32` is unnecessary
41  --> $DIR/unnecessary_cast.rs:60:5
42   |
43LL |     -1f32 as f32;
44   |     ^^^^^^^^^^^^ help: try: `-1_f32`
45
46error: casting integer literal to `i32` is unnecessary
47  --> $DIR/unnecessary_cast.rs:61:5
48   |
49LL |     1_i32 as i32;
50   |     ^^^^^^^^^^^^ help: try: `1_i32`
51
52error: casting float literal to `f32` is unnecessary
53  --> $DIR/unnecessary_cast.rs:62:5
54   |
55LL |     1_f32 as f32;
56   |     ^^^^^^^^^^^^ help: try: `1_f32`
57
58error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
59  --> $DIR/unnecessary_cast.rs:64:22
60   |
61LL |     let _: *mut u8 = [1u8, 2].as_ptr() as *const u8 as *mut u8;
62   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_ptr()`
63
64error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
65  --> $DIR/unnecessary_cast.rs:66:5
66   |
67LL |     [1u8, 2].as_ptr() as *const u8;
68   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_ptr()`
69
70error: casting raw pointers to the same type and constness is unnecessary (`*mut u8` -> `*mut u8`)
71  --> $DIR/unnecessary_cast.rs:68:5
72   |
73LL |     [1u8, 2].as_mut_ptr() as *mut u8;
74   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_mut_ptr()`
75
76error: casting raw pointers to the same type and constness is unnecessary (`*const u32` -> `*const u32`)
77  --> $DIR/unnecessary_cast.rs:79:5
78   |
79LL |     owo::<u32>([1u32].as_ptr()) as *const u32;
80   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `owo::<u32>([1u32].as_ptr())`
81
82error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
83  --> $DIR/unnecessary_cast.rs:80:5
84   |
85LL |     uwu::<u32, u8>([1u32].as_ptr()) as *const u8;
86   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::<u32, u8>([1u32].as_ptr())`
87
88error: casting raw pointers to the same type and constness is unnecessary (`*const u32` -> `*const u32`)
89  --> $DIR/unnecessary_cast.rs:82:5
90   |
91LL |     uwu::<u32, u32>([1u32].as_ptr()) as *const u32;
92   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::<u32, u32>([1u32].as_ptr())`
93
94error: casting to the same type is unnecessary (`u32` -> `u32`)
95  --> $DIR/unnecessary_cast.rs:117:5
96   |
97LL |     aaa() as u32;
98   |     ^^^^^^^^^^^^ help: try: `aaa()`
99
100error: casting to the same type is unnecessary (`u32` -> `u32`)
101  --> $DIR/unnecessary_cast.rs:119:5
102   |
103LL |     aaa() as u32;
104   |     ^^^^^^^^^^^^ help: try: `aaa()`
105
106error: casting integer literal to `f32` is unnecessary
107  --> $DIR/unnecessary_cast.rs:155:9
108   |
109LL |         100 as f32;
110   |         ^^^^^^^^^^ help: try: `100_f32`
111
112error: casting integer literal to `f64` is unnecessary
113  --> $DIR/unnecessary_cast.rs:156:9
114   |
115LL |         100 as f64;
116   |         ^^^^^^^^^^ help: try: `100_f64`
117
118error: casting integer literal to `f64` is unnecessary
119  --> $DIR/unnecessary_cast.rs:157:9
120   |
121LL |         100_i32 as f64;
122   |         ^^^^^^^^^^^^^^ help: try: `100_f64`
123
124error: casting integer literal to `f32` is unnecessary
125  --> $DIR/unnecessary_cast.rs:158:17
126   |
127LL |         let _ = -100 as f32;
128   |                 ^^^^^^^^^^^ help: try: `-100_f32`
129
130error: casting integer literal to `f64` is unnecessary
131  --> $DIR/unnecessary_cast.rs:159:17
132   |
133LL |         let _ = -100 as f64;
134   |                 ^^^^^^^^^^^ help: try: `-100_f64`
135
136error: casting integer literal to `f64` is unnecessary
137  --> $DIR/unnecessary_cast.rs:160:17
138   |
139LL |         let _ = -100_i32 as f64;
140   |                 ^^^^^^^^^^^^^^^ help: try: `-100_f64`
141
142error: casting float literal to `f32` is unnecessary
143  --> $DIR/unnecessary_cast.rs:161:9
144   |
145LL |         100. as f32;
146   |         ^^^^^^^^^^^ help: try: `100_f32`
147
148error: casting float literal to `f64` is unnecessary
149  --> $DIR/unnecessary_cast.rs:162:9
150   |
151LL |         100. as f64;
152   |         ^^^^^^^^^^^ help: try: `100_f64`
153
154error: casting integer literal to `u32` is unnecessary
155  --> $DIR/unnecessary_cast.rs:174:9
156   |
157LL |         1 as u32;
158   |         ^^^^^^^^ help: try: `1_u32`
159
160error: casting integer literal to `i32` is unnecessary
161  --> $DIR/unnecessary_cast.rs:175:9
162   |
163LL |         0x10 as i32;
164   |         ^^^^^^^^^^^ help: try: `0x10_i32`
165
166error: casting integer literal to `usize` is unnecessary
167  --> $DIR/unnecessary_cast.rs:176:9
168   |
169LL |         0b10 as usize;
170   |         ^^^^^^^^^^^^^ help: try: `0b10_usize`
171
172error: casting integer literal to `u16` is unnecessary
173  --> $DIR/unnecessary_cast.rs:177:9
174   |
175LL |         0o73 as u16;
176   |         ^^^^^^^^^^^ help: try: `0o73_u16`
177
178error: casting integer literal to `u32` is unnecessary
179  --> $DIR/unnecessary_cast.rs:178:9
180   |
181LL |         1_000_000_000 as u32;
182   |         ^^^^^^^^^^^^^^^^^^^^ help: try: `1_000_000_000_u32`
183
184error: casting float literal to `f64` is unnecessary
185  --> $DIR/unnecessary_cast.rs:180:9
186   |
187LL |         1.0 as f64;
188   |         ^^^^^^^^^^ help: try: `1.0_f64`
189
190error: casting float literal to `f32` is unnecessary
191  --> $DIR/unnecessary_cast.rs:181:9
192   |
193LL |         0.5 as f32;
194   |         ^^^^^^^^^^ help: try: `0.5_f32`
195
196error: casting integer literal to `i32` is unnecessary
197  --> $DIR/unnecessary_cast.rs:185:17
198   |
199LL |         let _ = -1 as i32;
200   |                 ^^^^^^^^^ help: try: `-1_i32`
201
202error: casting float literal to `f32` is unnecessary
203  --> $DIR/unnecessary_cast.rs:186:17
204   |
205LL |         let _ = -1.0 as f32;
206   |                 ^^^^^^^^^^^ help: try: `-1.0_f32`
207
208error: casting to the same type is unnecessary (`i32` -> `i32`)
209  --> $DIR/unnecessary_cast.rs:192:18
210   |
211LL |         let _ = &(x as i32);
212   |                  ^^^^^^^^^^ help: try: `{ x }`
213
214error: casting integer literal to `i32` is unnecessary
215  --> $DIR/unnecessary_cast.rs:198:22
216   |
217LL |         let _: i32 = -(1) as i32;
218   |                      ^^^^^^^^^^^ help: try: `-1_i32`
219
220error: casting integer literal to `i64` is unnecessary
221  --> $DIR/unnecessary_cast.rs:200:22
222   |
223LL |         let _: i64 = -(1) as i64;
224   |                      ^^^^^^^^^^^ help: try: `-1_i64`
225
226error: casting float literal to `f64` is unnecessary
227  --> $DIR/unnecessary_cast.rs:207:22
228   |
229LL |         let _: f64 = (-8.0 as f64).exp();
230   |                      ^^^^^^^^^^^^^ help: try: `(-8.0_f64)`
231
232error: casting float literal to `f64` is unnecessary
233  --> $DIR/unnecessary_cast.rs:209:23
234   |
235LL |         let _: f64 = -(8.0 as f64).exp(); // should suggest `-8.0_f64.exp()` here not to change code behavior
236   |                       ^^^^^^^^^^^^ help: try: `8.0_f64`
237
238error: casting to the same type is unnecessary (`f32` -> `f32`)
239  --> $DIR/unnecessary_cast.rs:217:20
240   |
241LL |         let _num = foo() as f32;
242   |                    ^^^^^^^^^^^^ help: try: `foo()`
243
244error: aborting due to 40 previous errors
245