@@ -150,35 +150,41 @@ error: casting float literal to `f32` is unnecessary
150150LL | let _ = -1.0 as f32;
151151 | ^^^^^^^^^^^ help: try: `-1.0_f32`
152152
153+ error: casting to the same type is unnecessary (`i32` -> `i32`)
154+ --> $DIR/unnecessary_cast.rs:101:18
155+ |
156+ LL | let _ = &(x as i32);
157+ | ^^^^^^^^^^ help: try: `{ x }`
158+
153159error: casting integer literal to `i32` is unnecessary
154- --> $DIR/unnecessary_cast.rs:104 :22
160+ --> $DIR/unnecessary_cast.rs:107 :22
155161 |
156162LL | let _: i32 = -(1) as i32;
157163 | ^^^^^^^^^^^ help: try: `-1_i32`
158164
159165error: casting integer literal to `i64` is unnecessary
160- --> $DIR/unnecessary_cast.rs:106 :22
166+ --> $DIR/unnecessary_cast.rs:109 :22
161167 |
162168LL | let _: i64 = -(1) as i64;
163169 | ^^^^^^^^^^^ help: try: `-1_i64`
164170
165171error: casting float literal to `f64` is unnecessary
166- --> $DIR/unnecessary_cast.rs:113 :22
172+ --> $DIR/unnecessary_cast.rs:116 :22
167173 |
168174LL | let _: f64 = (-8.0 as f64).exp();
169175 | ^^^^^^^^^^^^^ help: try: `(-8.0_f64)`
170176
171177error: casting float literal to `f64` is unnecessary
172- --> $DIR/unnecessary_cast.rs:115 :23
178+ --> $DIR/unnecessary_cast.rs:118 :23
173179 |
174180LL | let _: f64 = -(8.0 as f64).exp(); // should suggest `-8.0_f64.exp()` here not to change code behavior
175181 | ^^^^^^^^^^^^ help: try: `8.0_f64`
176182
177183error: casting to the same type is unnecessary (`f32` -> `f32`)
178- --> $DIR/unnecessary_cast.rs:123 :20
184+ --> $DIR/unnecessary_cast.rs:126 :20
179185 |
180186LL | let _num = foo() as f32;
181187 | ^^^^^^^^^^^^ help: try: `foo()`
182188
183- error: aborting due to 30 previous errors
189+ error: aborting due to 31 previous errors
184190
0 commit comments