@@ -188,7 +188,6 @@ pub struct Cache {
188
188
stack : Vec < String > ,
189
189
parent_stack : Vec < ast:: DefId > ,
190
190
search_index : Vec < IndexItem > ,
191
- privmod : bool ,
192
191
public_items : NodeSet ,
193
192
194
193
// In rare case where a structure is defined in one module but implemented
@@ -319,7 +318,6 @@ pub fn run(mut krate: clean::Crate, external_html: &ExternalHtml, dst: Path) ->
319
318
search_index : Vec :: new ( ) ,
320
319
extern_locations : HashMap :: new ( ) ,
321
320
primitive_locations : HashMap :: new ( ) ,
322
- privmod : false ,
323
321
public_items : public_items,
324
322
orphan_methods : Vec :: new ( ) ,
325
323
traits : analysis. as_ref ( ) . map ( |a| {
@@ -762,16 +760,6 @@ impl<'a> SourceCollector<'a> {
762
760
763
761
impl DocFolder for Cache {
764
762
fn fold_item ( & mut self , item : clean:: Item ) -> Option < clean:: Item > {
765
- // If this is a private module, we don't want it in the search index.
766
- let orig_privmod = match item. inner {
767
- clean:: ModuleItem ( ..) => {
768
- let prev = self . privmod ;
769
- self . privmod = prev || item. visibility != Some ( ast:: Public ) ;
770
- prev
771
- }
772
- _ => self . privmod ,
773
- } ;
774
-
775
763
// Register any generics to their corresponding string. This is used
776
764
// when pretty-printing types
777
765
match item. inner {
@@ -859,7 +847,7 @@ impl DocFolder for Cache {
859
847
} ;
860
848
861
849
match parent {
862
- ( parent, Some ( path) ) if is_method || ( ! self . privmod && ! hidden_field) => {
850
+ ( parent, Some ( path) ) if is_method || ! hidden_field => {
863
851
self . search_index . push ( IndexItem {
864
852
ty : shortty ( & item) ,
865
853
name : s. to_string ( ) ,
@@ -868,7 +856,7 @@ impl DocFolder for Cache {
868
856
parent : parent,
869
857
} ) ;
870
858
}
871
- ( Some ( parent) , None ) if is_method || ( ! self . privmod && ! hidden_field) => {
859
+ ( Some ( parent) , None ) if is_method || ! hidden_field => {
872
860
if ast_util:: is_local ( parent) {
873
861
// We have a parent, but we don't know where they're
874
862
// defined yet. Wait for later to index this item.
@@ -893,7 +881,7 @@ impl DocFolder for Cache {
893
881
clean:: StructItem ( ..) | clean:: EnumItem ( ..) |
894
882
clean:: TypedefItem ( ..) | clean:: TraitItem ( ..) |
895
883
clean:: FunctionItem ( ..) | clean:: ModuleItem ( ..) |
896
- clean:: ForeignFunctionItem ( ..) if ! self . privmod => {
884
+ clean:: ForeignFunctionItem ( ..) => {
897
885
// Reexported items mean that the same id can show up twice
898
886
// in the rustdoc ast that we're looking at. We know,
899
887
// however, that a reexported item doesn't show up in the
@@ -910,7 +898,7 @@ impl DocFolder for Cache {
910
898
}
911
899
// link variants to their parent enum because pages aren't emitted
912
900
// for each variant
913
- clean:: VariantItem ( ..) if ! self . privmod => {
901
+ clean:: VariantItem ( ..) => {
914
902
let mut stack = self . stack . clone ( ) ;
915
903
stack. pop ( ) ;
916
904
self . paths . insert ( item. def_id , ( stack, item_type:: Enum ) ) ;
@@ -1022,7 +1010,6 @@ impl DocFolder for Cache {
1022
1010
1023
1011
if pushed { self . stack . pop ( ) . unwrap ( ) ; }
1024
1012
if parent_pushed { self . parent_stack . pop ( ) . unwrap ( ) ; }
1025
- self . privmod = orig_privmod;
1026
1013
return ret;
1027
1014
}
1028
1015
}
@@ -1191,7 +1178,7 @@ impl Context {
1191
1178
// these modules are recursed into, but not rendered normally (a
1192
1179
// flag on the context).
1193
1180
if !self . render_redirect_pages {
1194
- self . render_redirect_pages = ignore_private_item ( & item) ;
1181
+ self . render_redirect_pages = ignore_empty_item ( & item) ;
1195
1182
}
1196
1183
1197
1184
match item. inner {
@@ -1442,7 +1429,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
1442
1429
try!( document ( w, item) ) ;
1443
1430
1444
1431
let mut indices = range ( 0 , items. len ( ) ) . filter ( |i| {
1445
- !ignore_private_item ( & items[ * i] )
1432
+ !ignore_empty_item ( & items[ * i] )
1446
1433
} ) . collect :: < Vec < uint > > ( ) ;
1447
1434
1448
1435
fn cmp ( i1 : & clean:: Item , i2 : & clean:: Item , idx1 : uint , idx2 : uint ) -> Ordering {
@@ -2159,7 +2146,7 @@ impl<'a> fmt::Show for Sidebar<'a> {
2159
2146
fn build_sidebar ( m : & clean:: Module ) -> HashMap < String , Vec < String > > {
2160
2147
let mut map = HashMap :: new ( ) ;
2161
2148
for item in m. items . iter ( ) {
2162
- if ignore_private_item ( item) { continue }
2149
+ if ignore_empty_item ( item) { continue }
2163
2150
2164
2151
let short = shortty ( item) . to_static_str ( ) ;
2165
2152
let myname = match item. name {
@@ -2213,11 +2200,10 @@ fn item_primitive(w: &mut fmt::Formatter,
2213
2200
render_methods ( w, it)
2214
2201
}
2215
2202
2216
- fn ignore_private_item ( it : & clean:: Item ) -> bool {
2203
+ fn ignore_empty_item ( it : & clean:: Item ) -> bool {
2217
2204
match it. inner {
2218
2205
clean:: ModuleItem ( ref m) => {
2219
- ( m. items . len ( ) == 0 && it. doc_value ( ) . is_none ( ) ) ||
2220
- it. visibility != Some ( ast:: Public )
2206
+ ( m. items . len ( ) == 0 && it. doc_value ( ) . is_none ( ) )
2221
2207
}
2222
2208
clean:: PrimitiveItem ( ..) => it. visibility != Some ( ast:: Public ) ,
2223
2209
_ => false ,
0 commit comments