@@ -57,46 +57,50 @@ pub fn get_attr<'a>(
57
57
name : & ' static str ,
58
58
) -> impl Iterator < Item = & ' a ast:: Attribute > {
59
59
attrs. iter ( ) . filter ( move |attr| {
60
- let attr_segments = & attr. path . segments ;
61
- if attr_segments. len ( ) == 2 && attr_segments[ 0 ] . ident . to_string ( ) == "clippy" {
62
- if let Some ( deprecation_status) =
63
- BUILTIN_ATTRIBUTES
64
- . iter ( )
65
- . find_map ( |( builtin_name, deprecation_status) | {
66
- if * builtin_name == attr_segments[ 1 ] . ident . to_string ( ) {
67
- Some ( deprecation_status)
68
- } else {
69
- None
70
- }
71
- } )
72
- {
73
- let mut db = sess. struct_span_err ( attr_segments[ 1 ] . ident . span , "Usage of deprecated attribute" ) ;
74
- match * deprecation_status {
75
- DeprecationStatus :: Deprecated => {
76
- db. emit ( ) ;
77
- false
78
- } ,
79
- DeprecationStatus :: Replaced ( new_name) => {
80
- db. span_suggestion (
81
- attr_segments[ 1 ] . ident . span ,
82
- "consider using" ,
83
- new_name. to_string ( ) ,
84
- Applicability :: MachineApplicable ,
85
- ) ;
86
- db. emit ( ) ;
87
- false
88
- } ,
89
- DeprecationStatus :: None => {
90
- db. cancel ( ) ;
91
- attr_segments[ 1 ] . ident . to_string ( ) == name
92
- } ,
60
+ if attr. is_doc_comment ( ) {
61
+ false
62
+ } else {
63
+ let attr_segments = & attr. get_normal_item ( ) . path . segments ;
64
+ if attr_segments. len ( ) == 2 && attr_segments[ 0 ] . ident . to_string ( ) == "clippy" {
65
+ if let Some ( deprecation_status) =
66
+ BUILTIN_ATTRIBUTES
67
+ . iter ( )
68
+ . find_map ( |( builtin_name, deprecation_status) | {
69
+ if * builtin_name == attr_segments[ 1 ] . ident . to_string ( ) {
70
+ Some ( deprecation_status)
71
+ } else {
72
+ None
73
+ }
74
+ } )
75
+ {
76
+ let mut db = sess. struct_span_err ( attr_segments[ 1 ] . ident . span , "Usage of deprecated attribute" ) ;
77
+ match * deprecation_status {
78
+ DeprecationStatus :: Deprecated => {
79
+ db. emit ( ) ;
80
+ false
81
+ } ,
82
+ DeprecationStatus :: Replaced ( new_name) => {
83
+ db. span_suggestion (
84
+ attr_segments[ 1 ] . ident . span ,
85
+ "consider using" ,
86
+ new_name. to_string ( ) ,
87
+ Applicability :: MachineApplicable ,
88
+ ) ;
89
+ db. emit ( ) ;
90
+ false
91
+ } ,
92
+ DeprecationStatus :: None => {
93
+ db. cancel ( ) ;
94
+ attr_segments[ 1 ] . ident . to_string ( ) == name
95
+ } ,
96
+ }
97
+ } else {
98
+ sess. span_err ( attr_segments[ 1 ] . ident . span , "Usage of unknown attribute" ) ;
99
+ false
93
100
}
94
101
} else {
95
- sess. span_err ( attr_segments[ 1 ] . ident . span , "Usage of unknown attribute" ) ;
96
102
false
97
103
}
98
- } else {
99
- false
100
104
}
101
105
} )
102
106
}
0 commit comments