@@ -556,7 +556,6 @@ impl MissingDoc {
556
556
& self ,
557
557
cx : & LateContext < ' _ > ,
558
558
def_id : LocalDefId ,
559
- sp : Span ,
560
559
article : & ' static str ,
561
560
desc : & ' static str ,
562
561
) {
@@ -583,13 +582,9 @@ impl MissingDoc {
583
582
let attrs = cx. tcx . hir ( ) . attrs ( cx. tcx . hir ( ) . local_def_id_to_hir_id ( def_id) ) ;
584
583
let has_doc = attrs. iter ( ) . any ( has_doc) ;
585
584
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
+ } ) ;
593
588
}
594
589
}
595
590
}
@@ -612,13 +607,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
612
607
}
613
608
614
609
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" ) ;
622
611
}
623
612
624
613
fn check_item ( & mut self , cx : & LateContext < ' _ > , it : & hir:: Item < ' _ > ) {
@@ -648,13 +637,13 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
648
637
649
638
let ( article, desc) = cx. tcx . article_and_description ( it. def_id . to_def_id ( ) ) ;
650
639
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) ;
652
641
}
653
642
654
643
fn check_trait_item ( & mut self , cx : & LateContext < ' _ > , trait_item : & hir:: TraitItem < ' _ > ) {
655
644
let ( article, desc) = cx. tcx . article_and_description ( trait_item. def_id . to_def_id ( ) ) ;
656
645
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) ;
658
647
}
659
648
660
649
fn check_impl_item ( & mut self , cx : & LateContext < ' _ > , impl_item : & hir:: ImplItem < ' _ > ) {
@@ -682,23 +671,23 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
682
671
}
683
672
684
673
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) ;
686
675
}
687
676
688
677
fn check_foreign_item ( & mut self , cx : & LateContext < ' _ > , foreign_item : & hir:: ForeignItem < ' _ > ) {
689
678
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) ;
691
680
}
692
681
693
682
fn check_field_def ( & mut self , cx : & LateContext < ' _ > , sf : & hir:: FieldDef < ' _ > ) {
694
683
if !sf. is_positional ( ) {
695
684
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" )
697
686
}
698
687
}
699
688
700
689
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" ) ;
702
691
}
703
692
}
704
693
0 commit comments