File tree Expand file tree Collapse file tree 2 files changed +5
-19
lines changed Expand file tree Collapse file tree 2 files changed +5
-19
lines changed Original file line number Diff line number Diff line change @@ -1346,7 +1346,6 @@ impl AttributeExt for Attribute {
13461346 fn doc_str ( & self ) -> Option < Symbol > {
13471347 match & self {
13481348 Attribute :: Parsed ( AttributeKind :: DocComment { comment, .. } ) => Some ( * comment) ,
1349- Attribute :: Unparsed ( _) if self . has_name ( sym:: doc) => self . value_str ( ) ,
13501349 _ => None ,
13511350 }
13521351 }
@@ -1361,9 +1360,6 @@ impl AttributeExt for Attribute {
13611360 Attribute :: Parsed ( AttributeKind :: DocComment { kind, comment, .. } ) => {
13621361 Some ( ( * comment, * kind) )
13631362 }
1364- Attribute :: Unparsed ( _) if self . has_name ( sym:: doc) => {
1365- self . value_str ( ) . map ( |s| ( s, CommentKind :: Line ) )
1366- }
13671363 _ => None ,
13681364 }
13691365 }
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ use rustc_attr_parsing::AttributeParser;
2525use rustc_errors:: { Applicability , LintDiagnostic } ;
2626use rustc_feature:: GateIssue ;
2727use rustc_hir as hir;
28- use rustc_hir:: attrs:: AttributeKind ;
28+ use rustc_hir:: attrs:: { AttributeKind , DocAttribute } ;
2929use rustc_hir:: def:: { DefKind , Res } ;
3030use rustc_hir:: def_id:: { CRATE_DEF_ID , DefId , LocalDefId } ;
3131use rustc_hir:: intravisit:: FnKind as HirFnKind ;
@@ -391,26 +391,16 @@ pub struct MissingDoc;
391391impl_lint_pass ! ( MissingDoc => [ MISSING_DOCS ] ) ;
392392
393393fn has_doc ( attr : & hir:: Attribute ) -> bool {
394- if attr. is_doc_comment ( ) {
394+ if matches ! ( attr, hir :: Attribute :: Parsed ( AttributeKind :: DocComment { .. } ) ) {
395395 return true ;
396396 }
397397
398- if !attr. has_name ( sym:: doc) {
399- return false ;
400- }
401-
402- if attr. value_str ( ) . is_some ( ) {
398+ if let hir:: Attribute :: Parsed ( AttributeKind :: Doc ( d) ) = attr
399+ && matches ! ( d. as_ref( ) , DocAttribute { hidden: Some ( ..) , .. } )
400+ {
403401 return true ;
404402 }
405403
406- if let Some ( list) = attr. meta_item_list ( ) {
407- for meta in list {
408- if meta. has_name ( sym:: hidden) {
409- return true ;
410- }
411- }
412- }
413-
414404 false
415405}
416406
You can’t perform that action at this time.
0 commit comments