@@ -552,7 +552,6 @@ impl MissingDoc {
552552 & self ,
553553 cx : & LateContext < ' _ > ,
554554 def_id : LocalDefId ,
555- sp : Span ,
556555 article : & ' static str ,
557556 desc : & ' static str ,
558557 ) {
@@ -579,16 +578,12 @@ impl MissingDoc {
579578 let attrs = cx. tcx . hir ( ) . attrs ( cx. tcx . hir ( ) . local_def_id_to_hir_id ( def_id) ) ;
580579 let has_doc = attrs. iter ( ) . any ( has_doc) ;
581580 if !has_doc {
582- cx. struct_span_lint (
583- MISSING_DOCS ,
584- cx. tcx . sess . source_map ( ) . guess_head_span ( sp) ,
585- |lint| {
586- lint. build ( fluent:: lint:: builtin_missing_doc)
587- . set_arg ( "article" , article)
588- . set_arg ( "desc" , desc)
589- . emit ( ) ;
590- } ,
591- ) ;
581+ cx. struct_span_lint ( MISSING_DOCS , cx. tcx . def_span ( def_id) , |lint| {
582+ lint. build ( fluent:: lint:: builtin_missing_doc)
583+ . set_arg ( "article" , article)
584+ . set_arg ( "desc" , desc)
585+ . emit ( ) ;
586+ } ) ;
592587 }
593588 }
594589}
@@ -611,13 +606,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
611606 }
612607
613608 fn check_crate ( & mut self , cx : & LateContext < ' _ > ) {
614- self . check_missing_docs_attrs (
615- cx,
616- CRATE_DEF_ID ,
617- cx. tcx . def_span ( CRATE_DEF_ID ) ,
618- "the" ,
619- "crate" ,
620- ) ;
609+ self . check_missing_docs_attrs ( cx, CRATE_DEF_ID , "the" , "crate" ) ;
621610 }
622611
623612 fn check_item ( & mut self , cx : & LateContext < ' _ > , it : & hir:: Item < ' _ > ) {
@@ -647,13 +636,13 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
647636
648637 let ( article, desc) = cx. tcx . article_and_description ( it. def_id . to_def_id ( ) ) ;
649638
650- self . check_missing_docs_attrs ( cx, it. def_id , it . span , article, desc) ;
639+ self . check_missing_docs_attrs ( cx, it. def_id , article, desc) ;
651640 }
652641
653642 fn check_trait_item ( & mut self , cx : & LateContext < ' _ > , trait_item : & hir:: TraitItem < ' _ > ) {
654643 let ( article, desc) = cx. tcx . article_and_description ( trait_item. def_id . to_def_id ( ) ) ;
655644
656- self . check_missing_docs_attrs ( cx, trait_item. def_id , trait_item . span , article, desc) ;
645+ self . check_missing_docs_attrs ( cx, trait_item. def_id , article, desc) ;
657646 }
658647
659648 fn check_impl_item ( & mut self , cx : & LateContext < ' _ > , impl_item : & hir:: ImplItem < ' _ > ) {
@@ -681,23 +670,23 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
681670 }
682671
683672 let ( article, desc) = cx. tcx . article_and_description ( impl_item. def_id . to_def_id ( ) ) ;
684- self . check_missing_docs_attrs ( cx, impl_item. def_id , impl_item . span , article, desc) ;
673+ self . check_missing_docs_attrs ( cx, impl_item. def_id , article, desc) ;
685674 }
686675
687676 fn check_foreign_item ( & mut self , cx : & LateContext < ' _ > , foreign_item : & hir:: ForeignItem < ' _ > ) {
688677 let ( article, desc) = cx. tcx . article_and_description ( foreign_item. def_id . to_def_id ( ) ) ;
689- self . check_missing_docs_attrs ( cx, foreign_item. def_id , foreign_item . span , article, desc) ;
678+ self . check_missing_docs_attrs ( cx, foreign_item. def_id , article, desc) ;
690679 }
691680
692681 fn check_field_def ( & mut self , cx : & LateContext < ' _ > , sf : & hir:: FieldDef < ' _ > ) {
693682 if !sf. is_positional ( ) {
694683 let def_id = cx. tcx . hir ( ) . local_def_id ( sf. hir_id ) ;
695- self . check_missing_docs_attrs ( cx, def_id, sf . span , "a" , "struct field" )
684+ self . check_missing_docs_attrs ( cx, def_id, "a" , "struct field" )
696685 }
697686 }
698687
699688 fn check_variant ( & mut self , cx : & LateContext < ' _ > , v : & hir:: Variant < ' _ > ) {
700- self . check_missing_docs_attrs ( cx, cx. tcx . hir ( ) . local_def_id ( v. id ) , v . span , "a" , "variant" ) ;
689+ self . check_missing_docs_attrs ( cx, cx. tcx . hir ( ) . local_def_id ( v. id ) , "a" , "variant" ) ;
701690 }
702691}
703692
0 commit comments