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 @@ -1345,7 +1345,6 @@ impl AttributeExt for Attribute {
13451345 fn doc_str ( & self ) -> Option < Symbol > {
13461346 match & self {
13471347 Attribute :: Parsed ( AttributeKind :: DocComment { comment, .. } ) => Some ( * comment) ,
1348- Attribute :: Unparsed ( _) if self . has_name ( sym:: doc) => self . value_str ( ) ,
13491348 _ => None ,
13501349 }
13511350 }
@@ -1360,9 +1359,6 @@ impl AttributeExt for Attribute {
13601359 Attribute :: Parsed ( AttributeKind :: DocComment { kind, comment, .. } ) => {
13611360 Some ( ( * comment, * kind) )
13621361 }
1363- Attribute :: Unparsed ( _) if self . has_name ( sym:: doc) => {
1364- self . value_str ( ) . map ( |s| ( s, CommentKind :: Line ) )
1365- }
13661362 _ => None ,
13671363 }
13681364 }
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 ;
@@ -396,26 +396,16 @@ pub struct MissingDoc;
396396impl_lint_pass ! ( MissingDoc => [ MISSING_DOCS ] ) ;
397397
398398fn has_doc ( attr : & hir:: Attribute ) -> bool {
399- if attr. is_doc_comment ( ) . is_some ( ) {
399+ if matches ! ( attr, hir :: Attribute :: Parsed ( AttributeKind :: DocComment { .. } ) ) {
400400 return true ;
401401 }
402402
403- if !attr. has_name ( sym:: doc) {
404- return false ;
405- }
406-
407- if attr. value_str ( ) . is_some ( ) {
403+ if let hir:: Attribute :: Parsed ( AttributeKind :: Doc ( d) ) = attr
404+ && matches ! ( d. as_ref( ) , DocAttribute { hidden: Some ( ..) , .. } )
405+ {
408406 return true ;
409407 }
410408
411- if let Some ( list) = attr. meta_item_list ( ) {
412- for meta in list {
413- if meta. has_name ( sym:: hidden) {
414- return true ;
415- }
416- }
417- }
418-
419409 false
420410}
421411
You can’t perform that action at this time.
0 commit comments