11use 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 } ;
33use clippy_utils:: diagnostics:: span_lint_and_then;
44use clippy_utils:: source:: { SpanRangeExt , first_line_of_span} ;
5- use rustc_ast:: { Attribute , Item , ItemKind , MetaItemInner } ;
5+ use rustc_ast:: { Attribute , Item , ItemKind } ;
66use rustc_errors:: Applicability ;
77use rustc_lint:: { EarlyContext , LintContext } ;
88use rustc_middle:: lint:: in_external_macro;
@@ -20,11 +20,13 @@ pub(super) fn check(cx: &EarlyContext<'_>, item: &Item, attrs: &[Attribute]) {
2020 for lint in lint_list {
2121 match item. kind {
2222 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 ( )
2628 && matches ! (
27- ident . name. as_str( ) ,
29+ name. as_str( ) ,
2830 "ambiguous_glob_reexports"
2931 | "dead_code"
3032 | "deprecated"
@@ -39,9 +41,9 @@ pub(super) fn check(cx: &EarlyContext<'_>, item: &Item, attrs: &[Attribute]) {
3941 return ;
4042 }
4143
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( ) ,
4547 "wildcard_imports"
4648 | "enum_glob_use"
4749 | "redundant_pub_crate"
@@ -52,7 +54,7 @@ pub(super) fn check(cx: &EarlyContext<'_>, item: &Item, attrs: &[Attribute]) {
5254 | "disallowed_types"
5355 | "unused_trait_names"
5456 )
55- } ) {
57+ {
5658 return ;
5759 }
5860 } ,
0 commit comments