@@ -25,35 +25,6 @@ pub fn strip_hidden(krate: clean::Crate) -> plugins::PluginResult {
25
25
26
26
// strip all #[doc(hidden)] items
27
27
let krate = {
28
- struct Stripper < ' a > {
29
- retained : & ' a mut DefIdSet ,
30
- update_retained : bool ,
31
- }
32
- impl < ' a > fold:: DocFolder for Stripper < ' a > {
33
- fn fold_item ( & mut self , i : Item ) -> Option < Item > {
34
- if i. attrs . list ( "doc" ) . has_word ( "hidden" ) {
35
- debug ! ( "found one in strip_hidden; removing" ) ;
36
- // use a dedicated hidden item for given item type if any
37
- match i. inner {
38
- clean:: StructFieldItem ( ..) | clean:: ModuleItem ( ..) => {
39
- // We need to recurse into stripped modules to
40
- // strip things like impl methods but when doing so
41
- // we must not add any items to the `retained` set.
42
- let old = mem:: replace ( & mut self . update_retained , false ) ;
43
- let ret = Strip ( self . fold_item_recur ( i) . unwrap ( ) ) . fold ( ) ;
44
- self . update_retained = old;
45
- return ret;
46
- }
47
- _ => return None ,
48
- }
49
- } else {
50
- if self . update_retained {
51
- self . retained . insert ( i. def_id ) ;
52
- }
53
- }
54
- self . fold_item_recur ( i)
55
- }
56
- }
57
28
let mut stripper = Stripper { retained : & mut retained, update_retained : true } ;
58
29
stripper. fold_crate ( krate)
59
30
} ;
@@ -62,3 +33,34 @@ pub fn strip_hidden(krate: clean::Crate) -> plugins::PluginResult {
62
33
let mut stripper = ImplStripper { retained : & retained } ;
63
34
stripper. fold_crate ( krate)
64
35
}
36
+
37
+ struct Stripper < ' a > {
38
+ retained : & ' a mut DefIdSet ,
39
+ update_retained : bool ,
40
+ }
41
+
42
+ impl < ' a > fold:: DocFolder for Stripper < ' a > {
43
+ fn fold_item ( & mut self , i : Item ) -> Option < Item > {
44
+ if i. attrs . list ( "doc" ) . has_word ( "hidden" ) {
45
+ debug ! ( "found one in strip_hidden; removing" ) ;
46
+ // use a dedicated hidden item for given item type if any
47
+ match i. inner {
48
+ clean:: StructFieldItem ( ..) | clean:: ModuleItem ( ..) => {
49
+ // We need to recurse into stripped modules to
50
+ // strip things like impl methods but when doing so
51
+ // we must not add any items to the `retained` set.
52
+ let old = mem:: replace ( & mut self . update_retained , false ) ;
53
+ let ret = Strip ( self . fold_item_recur ( i) . unwrap ( ) ) . fold ( ) ;
54
+ self . update_retained = old;
55
+ return ret;
56
+ }
57
+ _ => return None ,
58
+ }
59
+ } else {
60
+ if self . update_retained {
61
+ self . retained . insert ( i. def_id ) ;
62
+ }
63
+ }
64
+ self . fold_item_recur ( i)
65
+ }
66
+ }
0 commit comments