File tree 3 files changed +45
-13
lines changed 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!(
239
239
}
240
240
);
241
241
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
-
248
242
// This should warn the import is unused but should not trigger anon_trait_imports
249
243
#[warn(unused)]
250
244
mod unused_import {
251
245
252
246
}
253
247
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
+
254
270
// Limitation: Suggests `use std::any::{Any as _, Any as _};`
255
271
// mod repeated_renamed {
256
272
// 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!(
239
239
}
240
240
) ;
241
241
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
-
248
242
// This should warn the import is unused but should not trigger anon_trait_imports
249
243
#[ warn( unused) ]
250
244
mod unused_import {
251
245
use std:: any:: Any ;
252
246
}
253
247
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
+
254
270
// Limitation: Suggests `use std::any::{Any as _, Any as _};`
255
271
// mod repeated_renamed {
256
272
// use std::any::{Any, Any as MyAny};
Original file line number Diff line number Diff line change 1
1
error: unused import: `std::any::Any`
2
- --> tests/ui/anon_trait_imports.rs:251 :9
2
+ --> tests/ui/anon_trait_imports.rs:245 :9
3
3
|
4
4
LL | use std::any::Any;
5
5
| ^^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments