File tree 3 files changed +40
-1
lines changed
3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -244,3 +244,18 @@ proc_macros::with_span!(
244
244
// use std::any::Any::{self};
245
245
// "foo".type_id();
246
246
// }
247
+
248
+ // This should warn the import is unused but should not trigger anon_trait_imports
249
+ #[warn(unused)]
250
+ mod unused_import {
251
+
252
+ }
253
+
254
+ // Limitation: Suggests `use std::any::{Any as _, Any as _};`
255
+ // mod repeated_renamed {
256
+ // use std::any::{Any, Any as MyAny};
257
+
258
+ // fn foo() {
259
+ // "foo".type_id();
260
+ // }
261
+ // }
Original file line number Diff line number Diff line change @@ -244,3 +244,18 @@ proc_macros::with_span!(
244
244
// use std::any::Any::{self};
245
245
// "foo".type_id();
246
246
// }
247
+
248
+ // This should warn the import is unused but should not trigger anon_trait_imports
249
+ #[ warn( unused) ]
250
+ mod unused_import {
251
+ use std:: any:: Any ;
252
+ }
253
+
254
+ // Limitation: Suggests `use std::any::{Any as _, Any as _};`
255
+ // mod repeated_renamed {
256
+ // use std::any::{Any, Any as MyAny};
257
+
258
+ // fn foo() {
259
+ // "foo".type_id();
260
+ // }
261
+ // }
Original file line number Diff line number Diff line change
1
+ error: unused import: `std::any::Any`
2
+ --> tests/ui/anon_trait_imports.rs:251:9
3
+ |
4
+ LL | use std::any::Any;
5
+ | ^^^^^^^^^^^^^
6
+ |
7
+ = note: `-D unused-imports` implied by `-D warnings`
8
+ = help: to override `-D warnings` add `#[allow(unused_imports)]`
9
+
1
10
error: importing trait that is only used anonymously
2
11
--> tests/ui/anon_trait_imports.rs:12:19
3
12
|
@@ -60,5 +69,5 @@ LL | foo!();
60
69
|
61
70
= note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
62
71
63
- error: aborting due to 9 previous errors
72
+ error: aborting due to 10 previous errors
64
73
You can’t perform that action at this time.
0 commit comments