]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/unnecessary_cast.stderr
Rollup merge of #99880 - compiler-errors:escape-ascii-is-not-exact-size-iterator...
[rust.git] / src / tools / clippy / tests / ui / unnecessary_cast.stderr
1 error: casting integer literal to `i32` is unnecessary
2   --> $DIR/unnecessary_cast.rs:14:5
3    |
4 LL |     1i32 as i32;
5    |     ^^^^^^^^^^^ help: try: `1_i32`
6    |
7    = note: `-D clippy::unnecessary-cast` implied by `-D warnings`
8
9 error: casting float literal to `f32` is unnecessary
10   --> $DIR/unnecessary_cast.rs:15:5
11    |
12 LL |     1f32 as f32;
13    |     ^^^^^^^^^^^ help: try: `1_f32`
14
15 error: casting to the same type is unnecessary (`bool` -> `bool`)
16   --> $DIR/unnecessary_cast.rs:16:5
17    |
18 LL |     false as bool;
19    |     ^^^^^^^^^^^^^ help: try: `false`
20
21 error: casting integer literal to `i32` is unnecessary
22   --> $DIR/unnecessary_cast.rs:19:5
23    |
24 LL |     -1_i32 as i32;
25    |     ^^^^^^^^^^^^^ help: try: `-1_i32`
26
27 error: casting integer literal to `i32` is unnecessary
28   --> $DIR/unnecessary_cast.rs:20:5
29    |
30 LL |     - 1_i32 as i32;
31    |     ^^^^^^^^^^^^^^ help: try: `- 1_i32`
32
33 error: casting float literal to `f32` is unnecessary
34   --> $DIR/unnecessary_cast.rs:21:5
35    |
36 LL |     -1f32 as f32;
37    |     ^^^^^^^^^^^^ help: try: `-1_f32`
38
39 error: casting integer literal to `i32` is unnecessary
40   --> $DIR/unnecessary_cast.rs:22:5
41    |
42 LL |     1_i32 as i32;
43    |     ^^^^^^^^^^^^ help: try: `1_i32`
44
45 error: casting float literal to `f32` is unnecessary
46   --> $DIR/unnecessary_cast.rs:23:5
47    |
48 LL |     1_f32 as f32;
49    |     ^^^^^^^^^^^^ help: try: `1_f32`
50
51 error: casting integer literal to `f32` is unnecessary
52   --> $DIR/unnecessary_cast.rs:53:9
53    |
54 LL |         100 as f32;
55    |         ^^^^^^^^^^ help: try: `100_f32`
56
57 error: casting integer literal to `f64` is unnecessary
58   --> $DIR/unnecessary_cast.rs:54:9
59    |
60 LL |         100 as f64;
61    |         ^^^^^^^^^^ help: try: `100_f64`
62
63 error: casting integer literal to `f64` is unnecessary
64   --> $DIR/unnecessary_cast.rs:55:9
65    |
66 LL |         100_i32 as f64;
67    |         ^^^^^^^^^^^^^^ help: try: `100_f64`
68
69 error: casting integer literal to `f32` is unnecessary
70   --> $DIR/unnecessary_cast.rs:56:17
71    |
72 LL |         let _ = -100 as f32;
73    |                 ^^^^^^^^^^^ help: try: `-100_f32`
74
75 error: casting integer literal to `f64` is unnecessary
76   --> $DIR/unnecessary_cast.rs:57:17
77    |
78 LL |         let _ = -100 as f64;
79    |                 ^^^^^^^^^^^ help: try: `-100_f64`
80
81 error: casting integer literal to `f64` is unnecessary
82   --> $DIR/unnecessary_cast.rs:58:17
83    |
84 LL |         let _ = -100_i32 as f64;
85    |                 ^^^^^^^^^^^^^^^ help: try: `-100_f64`
86
87 error: casting float literal to `f32` is unnecessary
88   --> $DIR/unnecessary_cast.rs:59:9
89    |
90 LL |         100. as f32;
91    |         ^^^^^^^^^^^ help: try: `100_f32`
92
93 error: casting float literal to `f64` is unnecessary
94   --> $DIR/unnecessary_cast.rs:60:9
95    |
96 LL |         100. as f64;
97    |         ^^^^^^^^^^^ help: try: `100_f64`
98
99 error: casting integer literal to `u32` is unnecessary
100   --> $DIR/unnecessary_cast.rs:72:9
101    |
102 LL |         1 as u32;
103    |         ^^^^^^^^ help: try: `1_u32`
104
105 error: casting integer literal to `i32` is unnecessary
106   --> $DIR/unnecessary_cast.rs:73:9
107    |
108 LL |         0x10 as i32;
109    |         ^^^^^^^^^^^ help: try: `0x10_i32`
110
111 error: casting integer literal to `usize` is unnecessary
112   --> $DIR/unnecessary_cast.rs:74:9
113    |
114 LL |         0b10 as usize;
115    |         ^^^^^^^^^^^^^ help: try: `0b10_usize`
116
117 error: casting integer literal to `u16` is unnecessary
118   --> $DIR/unnecessary_cast.rs:75:9
119    |
120 LL |         0o73 as u16;
121    |         ^^^^^^^^^^^ help: try: `0o73_u16`
122
123 error: casting integer literal to `u32` is unnecessary
124   --> $DIR/unnecessary_cast.rs:76:9
125    |
126 LL |         1_000_000_000 as u32;
127    |         ^^^^^^^^^^^^^^^^^^^^ help: try: `1_000_000_000_u32`
128
129 error: casting float literal to `f64` is unnecessary
130   --> $DIR/unnecessary_cast.rs:78:9
131    |
132 LL |         1.0 as f64;
133    |         ^^^^^^^^^^ help: try: `1.0_f64`
134
135 error: casting float literal to `f32` is unnecessary
136   --> $DIR/unnecessary_cast.rs:79:9
137    |
138 LL |         0.5 as f32;
139    |         ^^^^^^^^^^ help: try: `0.5_f32`
140
141 error: casting integer literal to `i32` is unnecessary
142   --> $DIR/unnecessary_cast.rs:83:17
143    |
144 LL |         let _ = -1 as i32;
145    |                 ^^^^^^^^^ help: try: `-1_i32`
146
147 error: casting float literal to `f32` is unnecessary
148   --> $DIR/unnecessary_cast.rs:84:17
149    |
150 LL |         let _ = -1.0 as f32;
151    |                 ^^^^^^^^^^^ help: try: `-1.0_f32`
152
153 error: casting integer literal to `i32` is unnecessary
154   --> $DIR/unnecessary_cast.rs:93:22
155    |
156 LL |         let _: i32 = -(1) as i32;
157    |                      ^^^^^^^^^^^ help: try: `-1_i32`
158
159 error: casting integer literal to `i64` is unnecessary
160   --> $DIR/unnecessary_cast.rs:95:22
161    |
162 LL |         let _: i64 = -(1) as i64;
163    |                      ^^^^^^^^^^^ help: try: `-1_i64`
164
165 error: casting float literal to `f64` is unnecessary
166   --> $DIR/unnecessary_cast.rs:102:22
167    |
168 LL |         let _: f64 = (-8.0 as f64).exp();
169    |                      ^^^^^^^^^^^^^ help: try: `(-8.0_f64)`
170
171 error: casting float literal to `f64` is unnecessary
172   --> $DIR/unnecessary_cast.rs:104:23
173    |
174 LL |         let _: f64 = -(8.0 as f64).exp(); // should suggest `-8.0_f64.exp()` here not to change code behavior
175    |                       ^^^^^^^^^^^^ help: try: `8.0_f64`
176
177 error: casting to the same type is unnecessary (`f32` -> `f32`)
178   --> $DIR/unnecessary_cast.rs:112:20
179    |
180 LL |         let _num = foo() as f32;
181    |                    ^^^^^^^^^^^^ help: try: `foo()`
182
183 error: aborting due to 30 previous errors
184