File tree Expand file tree Collapse file tree 3 files changed +45
-13
lines changed Expand file tree Collapse file tree 3 files changed +45
-13
lines changed Original file line number Diff line number Diff line change @@ -239,18 +239,34 @@ proc_macros::with_span!(
239239 }
240240);
241241
242- // Limitation: Suggests `use std::any::Any as _::{self};` which looks weird
243- // fn use_trait_self_good() {
244- // use std::any::Any::{self};
245- // "foo".type_id();
246- // }
247-
248242// This should warn the import is unused but should not trigger anon_trait_imports
249243#[warn(unused)]
250244mod unused_import {
251245
252246}
253247
248+ #[allow(clippy::anon_trait_imports)]
249+ fn allow_lint_fn() {
250+ use std::any::Any;
251+
252+ "foo".type_id();
253+ }
254+
255+ #[allow(clippy::anon_trait_imports)]
256+ mod allow_lint_mod {
257+ use std::any::Any;
258+
259+ fn foo() {
260+ "foo".type_id();
261+ }
262+ }
263+
264+ // Limitation: Suggests `use std::any::Any as _::{self};` which looks weird
265+ // fn use_trait_self_good() {
266+ // use std::any::Any::{self};
267+ // "foo".type_id();
268+ // }
269+
254270// Limitation: Suggests `use std::any::{Any as _, Any as _};`
255271// mod repeated_renamed {
256272// use std::any::{Any, Any as MyAny};
Original file line number Diff line number Diff line change @@ -239,18 +239,34 @@ proc_macros::with_span!(
239239 }
240240) ;
241241
242- // Limitation: Suggests `use std::any::Any as _::{self};` which looks weird
243- // fn use_trait_self_good() {
244- // use std::any::Any::{self};
245- // "foo".type_id();
246- // }
247-
248242// This should warn the import is unused but should not trigger anon_trait_imports
249243#[ warn( unused) ]
250244mod unused_import {
251245 use std:: any:: Any ;
252246}
253247
248+ #[ allow( clippy:: anon_trait_imports) ]
249+ fn allow_lint_fn ( ) {
250+ use std:: any:: Any ;
251+
252+ "foo" . type_id ( ) ;
253+ }
254+
255+ #[ allow( clippy:: anon_trait_imports) ]
256+ mod allow_lint_mod {
257+ use std:: any:: Any ;
258+
259+ fn foo ( ) {
260+ "foo" . type_id ( ) ;
261+ }
262+ }
263+
264+ // Limitation: Suggests `use std::any::Any as _::{self};` which looks weird
265+ // fn use_trait_self_good() {
266+ // use std::any::Any::{self};
267+ // "foo".type_id();
268+ // }
269+
254270// Limitation: Suggests `use std::any::{Any as _, Any as _};`
255271// mod repeated_renamed {
256272// use std::any::{Any, Any as MyAny};
Original file line number Diff line number Diff line change 11error: unused import: `std::any::Any`
2- --> tests/ui/anon_trait_imports.rs:251 :9
2+ --> tests/ui/anon_trait_imports.rs:245 :9
33 |
44LL | use std::any::Any;
55 | ^^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments