11//! A collection of utility functions for the `strip_*` passes.
22use rustc_hir:: def_id:: DefId ;
33use rustc_middle:: ty:: { TyCtxt , Visibility } ;
4- use rustc_span:: symbol:: sym;
54use std:: mem;
65
7- use crate :: clean:: { self , Item , ItemId , ItemIdSet , NestedAttributesExt } ;
6+ use crate :: clean:: { self , Item , ItemId , ItemIdSet } ;
87use crate :: fold:: { strip_item, DocFolder } ;
98use crate :: formats:: cache:: Cache ;
109use crate :: visit_lib:: RustdocEffectiveVisibilities ;
@@ -163,7 +162,7 @@ impl<'a> ImplStripper<'a, '_> {
163162 // If the "for" item is exported and the impl block isn't `#[doc(hidden)]`, then we
164163 // need to keep it.
165164 self . cache . effective_visibilities . is_exported ( self . tcx , for_def_id)
166- && !item. attrs . lists ( sym :: doc ) . has_word ( sym :: hidden )
165+ && !item. is_doc_hidden ( )
167166 } else {
168167 false
169168 }
@@ -240,7 +239,7 @@ impl<'tcx> ImportStripper<'tcx> {
240239 // FIXME: This should be handled the same way as for HTML output.
241240 imp. imported_item_is_doc_hidden ( self . tcx )
242241 } else {
243- i. attrs . lists ( sym :: doc ) . has_word ( sym :: hidden )
242+ i. is_doc_hidden ( )
244243 }
245244 }
246245}
@@ -249,7 +248,7 @@ impl<'tcx> DocFolder for ImportStripper<'tcx> {
249248 fn fold_item ( & mut self , i : Item ) -> Option < Item > {
250249 match * i. kind {
251250 clean:: ImportItem ( imp) if self . import_should_be_hidden ( & i, & imp) => None ,
252- clean:: ImportItem ( _) if i. attrs . lists ( sym :: doc ) . has_word ( sym :: hidden ) => None ,
251+ clean:: ImportItem ( _) if i. is_doc_hidden ( ) => None ,
253252 clean:: ExternCrateItem { .. } | clean:: ImportItem ( ..)
254253 if i. visibility ( self . tcx ) != Some ( Visibility :: Public ) =>
255254 {
0 commit comments