@@ -744,7 +744,6 @@ trait UnusedDocCommentExt {
744
744
cx : & EarlyContext < ' _ > ,
745
745
node_span : Span ,
746
746
node_kind : & str ,
747
- is_macro_expansion : bool ,
748
747
attrs : & [ ast:: Attribute ] ,
749
748
) ;
750
749
}
@@ -755,7 +754,6 @@ impl UnusedDocCommentExt for UnusedDocComment {
755
754
cx : & EarlyContext < ' _ > ,
756
755
node_span : Span ,
757
756
node_kind : & str ,
758
- is_macro_expansion : bool ,
759
757
attrs : & [ ast:: Attribute ] ,
760
758
) {
761
759
let mut attrs = attrs. into_iter ( ) . peekable ( ) ;
@@ -783,12 +781,6 @@ impl UnusedDocCommentExt for UnusedDocComment {
783
781
node_span,
784
782
format ! ( "rustdoc does not generate documentation for {}" , node_kind) ,
785
783
) ;
786
- if is_macro_expansion {
787
- err. help (
788
- "to document an item produced by a macro, \
789
- the macro must produce the documentation as part of its expansion",
790
- ) ;
791
- }
792
784
err. emit ( ) ;
793
785
} ) ;
794
786
}
@@ -797,31 +789,24 @@ impl UnusedDocCommentExt for UnusedDocComment {
797
789
}
798
790
799
791
impl EarlyLintPass for UnusedDocComment {
800
- fn check_item ( & mut self , cx : & EarlyContext < ' _ > , item : & ast:: Item ) {
801
- if let ast:: ItemKind :: Mac ( ..) = item. kind {
802
- self . warn_if_doc ( cx, item. span , "macro expansions" , true , & item. attrs ) ;
803
- }
804
- }
805
-
806
792
fn check_stmt ( & mut self , cx : & EarlyContext < ' _ > , stmt : & ast:: Stmt ) {
807
- let ( kind, is_macro_expansion) = match stmt. kind {
808
- ast:: StmtKind :: Local ( ..) => ( "statements" , false ) ,
809
- ast:: StmtKind :: Item ( ..) => ( "inner items" , false ) ,
810
- ast:: StmtKind :: Mac ( ..) => ( "macro expansions" , true ) ,
793
+ let kind = match stmt. kind {
794
+ ast:: StmtKind :: Local ( ..) => "statements" ,
795
+ ast:: StmtKind :: Item ( ..) => "inner items" ,
811
796
// expressions will be reported by `check_expr`.
812
- ast:: StmtKind :: Semi ( ..) | ast:: StmtKind :: Expr ( ..) => return ,
797
+ ast:: StmtKind :: Semi ( ..) | ast:: StmtKind :: Expr ( ..) | ast :: StmtKind :: Mac ( .. ) => return ,
813
798
} ;
814
799
815
- self . warn_if_doc ( cx, stmt. span , kind, is_macro_expansion , stmt. kind . attrs ( ) ) ;
800
+ self . warn_if_doc ( cx, stmt. span , kind, stmt. kind . attrs ( ) ) ;
816
801
}
817
802
818
803
fn check_arm ( & mut self , cx : & EarlyContext < ' _ > , arm : & ast:: Arm ) {
819
804
let arm_span = arm. pat . span . with_hi ( arm. body . span . hi ( ) ) ;
820
- self . warn_if_doc ( cx, arm_span, "match arms" , false , & arm. attrs ) ;
805
+ self . warn_if_doc ( cx, arm_span, "match arms" , & arm. attrs ) ;
821
806
}
822
807
823
808
fn check_expr ( & mut self , cx : & EarlyContext < ' _ > , expr : & ast:: Expr ) {
824
- self . warn_if_doc ( cx, expr. span , "expressions" , false , & expr. attrs ) ;
809
+ self . warn_if_doc ( cx, expr. span , "expressions" , & expr. attrs ) ;
825
810
}
826
811
}
827
812
0 commit comments