@@ -552,7 +552,6 @@ impl MissingDoc {
552
552
& self ,
553
553
cx : & LateContext < ' _ > ,
554
554
def_id : LocalDefId ,
555
- sp : Span ,
556
555
article : & ' static str ,
557
556
desc : & ' static str ,
558
557
) {
@@ -579,16 +578,12 @@ impl MissingDoc {
579
578
let attrs = cx. tcx . hir ( ) . attrs ( cx. tcx . hir ( ) . local_def_id_to_hir_id ( def_id) ) ;
580
579
let has_doc = attrs. iter ( ) . any ( has_doc) ;
581
580
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
+ } ) ;
592
587
}
593
588
}
594
589
}
@@ -611,13 +606,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
611
606
}
612
607
613
608
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" ) ;
621
610
}
622
611
623
612
fn check_item ( & mut self , cx : & LateContext < ' _ > , it : & hir:: Item < ' _ > ) {
@@ -647,13 +636,13 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
647
636
648
637
let ( article, desc) = cx. tcx . article_and_description ( it. def_id . to_def_id ( ) ) ;
649
638
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) ;
651
640
}
652
641
653
642
fn check_trait_item ( & mut self , cx : & LateContext < ' _ > , trait_item : & hir:: TraitItem < ' _ > ) {
654
643
let ( article, desc) = cx. tcx . article_and_description ( trait_item. def_id . to_def_id ( ) ) ;
655
644
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) ;
657
646
}
658
647
659
648
fn check_impl_item ( & mut self , cx : & LateContext < ' _ > , impl_item : & hir:: ImplItem < ' _ > ) {
@@ -681,23 +670,23 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
681
670
}
682
671
683
672
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) ;
685
674
}
686
675
687
676
fn check_foreign_item ( & mut self , cx : & LateContext < ' _ > , foreign_item : & hir:: ForeignItem < ' _ > ) {
688
677
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) ;
690
679
}
691
680
692
681
fn check_field_def ( & mut self , cx : & LateContext < ' _ > , sf : & hir:: FieldDef < ' _ > ) {
693
682
if !sf. is_positional ( ) {
694
683
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" )
696
685
}
697
686
}
698
687
699
688
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" ) ;
701
690
}
702
691
}
703
692
0 commit comments