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