1
1
use super :: USELESS_ATTRIBUTE ;
2
- use super :: utils:: { extract_clippy_lint , is_lint_level, is_word} ;
2
+ use super :: utils:: { is_lint_level, is_word, namespace_and_lint } ;
3
3
use clippy_utils:: diagnostics:: span_lint_and_then;
4
4
use clippy_utils:: source:: { SpanRangeExt , first_line_of_span} ;
5
- use rustc_ast:: { Attribute , Item , ItemKind , MetaItemInner } ;
5
+ use rustc_ast:: { Attribute , Item , ItemKind } ;
6
6
use rustc_errors:: Applicability ;
7
7
use rustc_lint:: { EarlyContext , LintContext } ;
8
8
use rustc_middle:: lint:: in_external_macro;
@@ -20,11 +20,13 @@ pub(super) fn check(cx: &EarlyContext<'_>, item: &Item, attrs: &[Attribute]) {
20
20
for lint in lint_list {
21
21
match item. kind {
22
22
ItemKind :: Use ( ..) => {
23
- if let MetaItemInner :: MetaItem ( meta_item) = lint
24
- && meta_item. is_word ( )
25
- && let Some ( ident) = meta_item. ident ( )
23
+ let ( namespace @ ( Some ( sym:: clippy) | None ) , Some ( name) ) = namespace_and_lint ( lint) else {
24
+ return ;
25
+ } ;
26
+
27
+ if namespace. is_none ( )
26
28
&& matches ! (
27
- ident . name. as_str( ) ,
29
+ name. as_str( ) ,
28
30
"ambiguous_glob_reexports"
29
31
| "dead_code"
30
32
| "deprecated"
@@ -39,9 +41,9 @@ pub(super) fn check(cx: &EarlyContext<'_>, item: &Item, attrs: &[Attribute]) {
39
41
return ;
40
42
}
41
43
42
- if extract_clippy_lint ( lint ) . is_some_and ( |symbol| {
43
- matches ! (
44
- symbol . as_str( ) ,
44
+ if namespace == Some ( sym :: clippy )
45
+ && matches ! (
46
+ name . as_str( ) ,
45
47
"wildcard_imports"
46
48
| "enum_glob_use"
47
49
| "redundant_pub_crate"
@@ -52,7 +54,7 @@ pub(super) fn check(cx: &EarlyContext<'_>, item: &Item, attrs: &[Attribute]) {
52
54
| "disallowed_types"
53
55
| "unused_trait_names"
54
56
)
55
- } ) {
57
+ {
56
58
return ;
57
59
}
58
60
} ,
0 commit comments