@@ -469,18 +469,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
469469 return ;
470470 }
471471
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) ;
477474
478475 self . check_missing_docs_attrs (
479476 cx,
480477 Some ( trait_item. hir_id ) ,
481478 & trait_item. attrs ,
482479 trait_item. span ,
483- desc,
480+ & format ! ( "{} {}" , article , desc) ,
484481 ) ;
485482 }
486483
@@ -490,18 +487,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
490487 return ;
491488 }
492489
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) ;
499492 self . check_missing_docs_attrs (
500493 cx,
501494 Some ( impl_item. hir_id ) ,
502495 & impl_item. attrs ,
503496 impl_item. span ,
504- desc,
497+ & format ! ( "{} {}" , article , desc) ,
505498 ) ;
506499 }
507500
0 commit comments