File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Expand file tree Collapse file tree 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!(
244244// use std::any::Any::{self};
245245// "foo".type_id();
246246// }
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!(
244244// use std::any::Any::{self};
245245// "foo".type_id();
246246// }
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+
110error: importing trait that is only used anonymously
211 --> tests/ui/anon_trait_imports.rs:12:19
312 |
@@ -60,5 +69,5 @@ LL | foo!();
6069 |
6170 = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
6271
63- error: aborting due to 9 previous errors
72+ error: aborting due to 10 previous errors
6473
You can’t perform that action at this time.
0 commit comments