@@ -556,7 +556,6 @@ impl MissingDoc {
556556 & self ,
557557 cx : & LateContext < ' _ > ,
558558 def_id : LocalDefId ,
559- sp : Span ,
560559 article : & ' static str ,
561560 desc : & ' static str ,
562561 ) {
@@ -583,13 +582,9 @@ impl MissingDoc {
583582 let attrs = cx. tcx . hir ( ) . attrs ( cx. tcx . hir ( ) . local_def_id_to_hir_id ( def_id) ) ;
584583 let has_doc = attrs. iter ( ) . any ( has_doc) ;
585584 if !has_doc {
586- cx. struct_span_lint (
587- MISSING_DOCS ,
588- cx. tcx . sess . source_map ( ) . guess_head_span ( sp) ,
589- |lint| {
590- lint. build ( & format ! ( "missing documentation for {} {}" , article, desc) ) . emit ( ) ;
591- } ,
592- ) ;
585+ cx. struct_span_lint ( MISSING_DOCS , cx. tcx . def_span ( def_id) , |lint| {
586+ lint. build ( & format ! ( "missing documentation for {} {}" , article, desc) ) . emit ( ) ;
587+ } ) ;
593588 }
594589 }
595590}
@@ -612,13 +607,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
612607 }
613608
614609 fn check_crate ( & mut self , cx : & LateContext < ' _ > ) {
615- self . check_missing_docs_attrs (
616- cx,
617- CRATE_DEF_ID ,
618- cx. tcx . def_span ( CRATE_DEF_ID ) ,
619- "the" ,
620- "crate" ,
621- ) ;
610+ self . check_missing_docs_attrs ( cx, CRATE_DEF_ID , "the" , "crate" ) ;
622611 }
623612
624613 fn check_item ( & mut self , cx : & LateContext < ' _ > , it : & hir:: Item < ' _ > ) {
@@ -648,13 +637,13 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
648637
649638 let ( article, desc) = cx. tcx . article_and_description ( it. def_id . to_def_id ( ) ) ;
650639
651- self . check_missing_docs_attrs ( cx, it. def_id , it . span , article, desc) ;
640+ self . check_missing_docs_attrs ( cx, it. def_id , article, desc) ;
652641 }
653642
654643 fn check_trait_item ( & mut self , cx : & LateContext < ' _ > , trait_item : & hir:: TraitItem < ' _ > ) {
655644 let ( article, desc) = cx. tcx . article_and_description ( trait_item. def_id . to_def_id ( ) ) ;
656645
657- self . check_missing_docs_attrs ( cx, trait_item. def_id , trait_item . span , article, desc) ;
646+ self . check_missing_docs_attrs ( cx, trait_item. def_id , article, desc) ;
658647 }
659648
660649 fn check_impl_item ( & mut self , cx : & LateContext < ' _ > , impl_item : & hir:: ImplItem < ' _ > ) {
@@ -682,23 +671,23 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
682671 }
683672
684673 let ( article, desc) = cx. tcx . article_and_description ( impl_item. def_id . to_def_id ( ) ) ;
685- self . check_missing_docs_attrs ( cx, impl_item. def_id , impl_item . span , article, desc) ;
674+ self . check_missing_docs_attrs ( cx, impl_item. def_id , article, desc) ;
686675 }
687676
688677 fn check_foreign_item ( & mut self , cx : & LateContext < ' _ > , foreign_item : & hir:: ForeignItem < ' _ > ) {
689678 let ( article, desc) = cx. tcx . article_and_description ( foreign_item. def_id . to_def_id ( ) ) ;
690- self . check_missing_docs_attrs ( cx, foreign_item. def_id , foreign_item . span , article, desc) ;
679+ self . check_missing_docs_attrs ( cx, foreign_item. def_id , article, desc) ;
691680 }
692681
693682 fn check_field_def ( & mut self , cx : & LateContext < ' _ > , sf : & hir:: FieldDef < ' _ > ) {
694683 if !sf. is_positional ( ) {
695684 let def_id = cx. tcx . hir ( ) . local_def_id ( sf. hir_id ) ;
696- self . check_missing_docs_attrs ( cx, def_id, sf . span , "a" , "struct field" )
685+ self . check_missing_docs_attrs ( cx, def_id, "a" , "struct field" )
697686 }
698687 }
699688
700689 fn check_variant ( & mut self , cx : & LateContext < ' _ > , v : & hir:: Variant < ' _ > ) {
701- self . check_missing_docs_attrs ( cx, cx. tcx . hir ( ) . local_def_id ( v. id ) , v . span , "a" , "variant" ) ;
690+ self . check_missing_docs_attrs ( cx, cx. tcx . hir ( ) . local_def_id ( v. id ) , "a" , "variant" ) ;
702691 }
703692}
704693
0 commit comments