@@ -152,6 +152,7 @@ pub(crate) struct ImplStripper<'a, 'tcx> {
152
152
pub ( crate ) cache : & ' a Cache ,
153
153
pub ( crate ) is_json_output : bool ,
154
154
pub ( crate ) document_private : bool ,
155
+ pub ( crate ) document_hidden : bool ,
155
156
}
156
157
157
158
impl < ' a > ImplStripper < ' a , ' _ > {
@@ -163,12 +164,13 @@ impl<'a> ImplStripper<'a, '_> {
163
164
// If the "for" item is exported and the impl block isn't `#[doc(hidden)]`, then we
164
165
// need to keep it.
165
166
self . cache . effective_visibilities . is_exported ( self . tcx , for_def_id)
166
- && ( ( !item. is_doc_hidden ( )
167
- && for_def_id
168
- . as_local ( )
169
- . map ( |def_id| !inherits_doc_hidden ( self . tcx , def_id, None ) )
170
- . unwrap_or ( true ) )
171
- || self . cache . inlined_items . contains ( & for_def_id) )
167
+ && ( self . document_hidden
168
+ || ( ( !item. is_doc_hidden ( )
169
+ && for_def_id
170
+ . as_local ( )
171
+ . map ( |def_id| !inherits_doc_hidden ( self . tcx , def_id, None ) )
172
+ . unwrap_or ( true ) )
173
+ || self . cache . inlined_items . contains ( & for_def_id) ) )
172
174
} else {
173
175
false
174
176
}
@@ -237,6 +239,7 @@ impl<'a> DocFolder for ImplStripper<'a, '_> {
237
239
pub ( crate ) struct ImportStripper < ' tcx > {
238
240
pub ( crate ) tcx : TyCtxt < ' tcx > ,
239
241
pub ( crate ) is_json_output : bool ,
242
+ pub ( crate ) document_hidden : bool ,
240
243
}
241
244
242
245
impl < ' tcx > ImportStripper < ' tcx > {
@@ -253,8 +256,12 @@ impl<'tcx> ImportStripper<'tcx> {
253
256
impl < ' tcx > DocFolder for ImportStripper < ' tcx > {
254
257
fn fold_item ( & mut self , i : Item ) -> Option < Item > {
255
258
match * i. kind {
256
- clean:: ImportItem ( imp) if self . import_should_be_hidden ( & i, & imp) => None ,
257
- clean:: ImportItem ( _) if i. is_doc_hidden ( ) => None ,
259
+ clean:: ImportItem ( imp)
260
+ if !self . document_hidden && self . import_should_be_hidden ( & i, & imp) =>
261
+ {
262
+ None
263
+ }
264
+ // clean::ImportItem(_) if !self.document_hidden && i.is_doc_hidden() => None,
258
265
clean:: ExternCrateItem { .. } | clean:: ImportItem ( ..)
259
266
if i. visibility ( self . tcx ) != Some ( Visibility :: Public ) =>
260
267
{
0 commit comments