@@ -469,18 +469,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
469
469
return ;
470
470
}
471
471
472
- let desc = match trait_item. kind {
473
- hir:: TraitItemKind :: Const ( ..) => "an associated constant" ,
474
- hir:: TraitItemKind :: Fn ( ..) => "a trait method" ,
475
- hir:: TraitItemKind :: Type ( ..) => "an associated type" ,
476
- } ;
472
+ let def_id = cx. tcx . hir ( ) . local_def_id ( trait_item. hir_id ) ;
473
+ let ( article, desc) = cx. tcx . article_and_description ( def_id) ;
477
474
478
475
self . check_missing_docs_attrs (
479
476
cx,
480
477
Some ( trait_item. hir_id ) ,
481
478
& trait_item. attrs ,
482
479
trait_item. span ,
483
- desc,
480
+ & format ! ( "{} {}" , article , desc) ,
484
481
) ;
485
482
}
486
483
@@ -490,18 +487,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
490
487
return ;
491
488
}
492
489
493
- let desc = match impl_item. kind {
494
- hir:: ImplItemKind :: Const ( ..) => "an associated constant" ,
495
- hir:: ImplItemKind :: Fn ( ..) => "a method" ,
496
- hir:: ImplItemKind :: TyAlias ( _) => "an associated type" ,
497
- hir:: ImplItemKind :: OpaqueTy ( _) => "an associated `impl Trait` type" ,
498
- } ;
490
+ let def_id = cx. tcx . hir ( ) . local_def_id ( impl_item. hir_id ) ;
491
+ let ( article, desc) = cx. tcx . article_and_description ( def_id) ;
499
492
self . check_missing_docs_attrs (
500
493
cx,
501
494
Some ( impl_item. hir_id ) ,
502
495
& impl_item. attrs ,
503
496
impl_item. span ,
504
- desc,
497
+ & format ! ( "{} {}" , article , desc) ,
505
498
) ;
506
499
}
507
500
0 commit comments