@@ -10,7 +10,7 @@ use clippy_utils::source::{first_line_of_span, is_present_in_source, snippet_opt
1010use rustc_ast:: token:: { Token , TokenKind } ;
1111use rustc_ast:: tokenstream:: TokenTree ;
1212use rustc_ast:: {
13- AttrArgs , AttrArgsEq , AttrKind , AttrStyle , Attribute , LitKind , MetaItemKind , MetaItemLit , NestedMetaItem ,
13+ AttrArgs , AttrArgsEq , AttrId , AttrKind , AttrStyle , Attribute , LitKind , MetaItemKind , MetaItemLit , NestedMetaItem ,
1414} ;
1515use rustc_errors:: Applicability ;
1616use rustc_hir:: {
@@ -518,7 +518,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
518518 fn check_attribute ( & mut self , cx : & LateContext < ' tcx > , attr : & ' tcx Attribute ) {
519519 if let Some ( items) = & attr. meta_item_list ( ) {
520520 if let Some ( ident) = attr. ident ( ) {
521- if is_lint_level ( ident. name ) {
521+ if is_lint_level ( ident. name , attr . id ) {
522522 check_clippy_lint_names ( cx, ident. name , items) ;
523523 }
524524 if matches ! ( ident. name, sym:: allow | sym:: expect) {
@@ -556,7 +556,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
556556 return ;
557557 }
558558 if let Some ( lint_list) = & attr. meta_item_list ( ) {
559- if attr. ident ( ) . map_or ( false , |ident| is_lint_level ( ident. name ) ) {
559+ if attr. ident ( ) . map_or ( false , |ident| is_lint_level ( ident. name , attr . id ) ) {
560560 for lint in lint_list {
561561 match item. kind {
562562 ItemKind :: Use ( ..) => {
@@ -1205,6 +1205,6 @@ fn check_mismatched_target_os(cx: &EarlyContext<'_>, attr: &Attribute) {
12051205 }
12061206}
12071207
1208- fn is_lint_level ( symbol : Symbol ) -> bool {
1209- matches ! ( symbol, sym :: allow | sym :: expect | sym :: warn | sym :: deny | sym :: forbid )
1208+ fn is_lint_level ( symbol : Symbol , attr_id : AttrId ) -> bool {
1209+ Level :: from_symbol ( symbol, Some ( attr_id ) ) . is_some ( )
12101210}
0 commit comments