1
1
//! A collection of utility functions for the `strip_*` passes.
2
2
use rustc_hir:: def_id:: DefId ;
3
3
use rustc_middle:: ty:: { TyCtxt , Visibility } ;
4
- use rustc_span:: symbol:: sym;
5
4
use std:: mem;
6
5
7
- use crate :: clean:: { self , Item , ItemId , ItemIdSet , NestedAttributesExt } ;
6
+ use crate :: clean:: { self , Item , ItemId , ItemIdSet } ;
8
7
use crate :: fold:: { strip_item, DocFolder } ;
9
8
use crate :: formats:: cache:: Cache ;
10
9
use crate :: visit_lib:: RustdocEffectiveVisibilities ;
@@ -163,7 +162,7 @@ impl<'a> ImplStripper<'a, '_> {
163
162
// If the "for" item is exported and the impl block isn't `#[doc(hidden)]`, then we
164
163
// need to keep it.
165
164
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 ( )
167
166
} else {
168
167
false
169
168
}
@@ -240,7 +239,7 @@ impl<'tcx> ImportStripper<'tcx> {
240
239
// FIXME: This should be handled the same way as for HTML output.
241
240
imp. imported_item_is_doc_hidden ( self . tcx )
242
241
} else {
243
- i. attrs . lists ( sym :: doc ) . has_word ( sym :: hidden )
242
+ i. is_doc_hidden ( )
244
243
}
245
244
}
246
245
}
@@ -249,7 +248,7 @@ impl<'tcx> DocFolder for ImportStripper<'tcx> {
249
248
fn fold_item ( & mut self , i : Item ) -> Option < Item > {
250
249
match * i. kind {
251
250
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 ,
253
252
clean:: ExternCrateItem { .. } | clean:: ImportItem ( ..)
254
253
if i. visibility ( self . tcx ) != Some ( Visibility :: Public ) =>
255
254
{
0 commit comments