@@ -101,8 +101,6 @@ pub struct Context {
101
101
/// real location of an item. This is used to allow external links to
102
102
/// publicly reused items to redirect to the right location.
103
103
pub render_redirect_pages : bool ,
104
- /// All the passes that were run on this crate.
105
- pub passes : HashSet < String > ,
106
104
}
107
105
108
106
/// Indicates where an external crate can be found.
@@ -192,7 +190,6 @@ pub struct Cache {
192
190
parent_stack : Vec < ast:: DefId > ,
193
191
search_index : Vec < IndexItem > ,
194
192
privmod : bool ,
195
- remove_priv : bool ,
196
193
public_items : NodeSet ,
197
194
198
195
// In rare case where a structure is defined in one module but implemented
@@ -239,13 +236,9 @@ local_data_key!(pub cache_key: Arc<Cache>)
239
236
local_data_key ! ( pub current_location_key: Vec <String > )
240
237
241
238
/// Generates the documentation for `crate` into the directory `dst`
242
- pub fn run ( mut krate : clean:: Crate ,
243
- external_html : & ExternalHtml ,
244
- dst : Path ,
245
- passes : HashSet < String > ) -> io:: IoResult < ( ) > {
239
+ pub fn run ( mut krate : clean:: Crate , external_html : & ExternalHtml , dst : Path ) -> io:: IoResult < ( ) > {
246
240
let mut cx = Context {
247
241
dst : dst,
248
- passes : passes,
249
242
current : Vec :: new ( ) ,
250
243
root_path : String :: new ( ) ,
251
244
sidebar : HashMap :: new ( ) ,
@@ -327,7 +320,6 @@ pub fn run(mut krate: clean::Crate,
327
320
search_index : Vec :: new ( ) ,
328
321
extern_locations : HashMap :: new ( ) ,
329
322
primitive_locations : HashMap :: new ( ) ,
330
- remove_priv : cx. passes . contains ( "strip-private" ) ,
331
323
privmod : false ,
332
324
public_items : public_items,
333
325
orphan_methods : Vec :: new ( ) ,
@@ -775,7 +767,7 @@ impl DocFolder for Cache {
775
767
let orig_privmod = match item. inner {
776
768
clean:: ModuleItem ( ..) => {
777
769
let prev = self . privmod ;
778
- self . privmod = prev || ( self . remove_priv && item. visibility != Some ( ast:: Public ) ) ;
770
+ self . privmod = prev || item. visibility != Some ( ast:: Public ) ;
779
771
prev
780
772
}
781
773
_ => self . privmod ,
@@ -1200,7 +1192,7 @@ impl Context {
1200
1192
// these modules are recursed into, but not rendered normally (a
1201
1193
// flag on the context).
1202
1194
if !self . render_redirect_pages {
1203
- self . render_redirect_pages = self . ignore_private_item ( & item) ;
1195
+ self . render_redirect_pages = ignore_private_item ( & item) ;
1204
1196
}
1205
1197
1206
1198
match item. inner {
@@ -1219,7 +1211,7 @@ impl Context {
1219
1211
clean:: ModuleItem ( m) => m,
1220
1212
_ => unreachable ! ( )
1221
1213
} ;
1222
- this. sidebar = this . build_sidebar ( & m) ;
1214
+ this. sidebar = build_sidebar ( & m) ;
1223
1215
for item in m. items . into_iter ( ) {
1224
1216
f ( this, item) ;
1225
1217
}
@@ -1238,40 +1230,6 @@ impl Context {
1238
1230
_ => Ok ( ( ) )
1239
1231
}
1240
1232
}
1241
-
1242
- fn build_sidebar ( & self , m : & clean:: Module ) -> HashMap < String , Vec < String > > {
1243
- let mut map = HashMap :: new ( ) ;
1244
- for item in m. items . iter ( ) {
1245
- if self . ignore_private_item ( item) { continue }
1246
-
1247
- let short = shortty ( item) . to_static_str ( ) ;
1248
- let myname = match item. name {
1249
- None => continue ,
1250
- Some ( ref s) => s. to_string ( ) ,
1251
- } ;
1252
- let v = match map. entry ( short. to_string ( ) ) {
1253
- Vacant ( entry) => entry. set ( Vec :: with_capacity ( 1 ) ) ,
1254
- Occupied ( entry) => entry. into_mut ( ) ,
1255
- } ;
1256
- v. push ( myname) ;
1257
- }
1258
-
1259
- for ( _, items) in map. iter_mut ( ) {
1260
- items. as_mut_slice ( ) . sort ( ) ;
1261
- }
1262
- return map;
1263
- }
1264
-
1265
- fn ignore_private_item ( & self , it : & clean:: Item ) -> bool {
1266
- match it. inner {
1267
- clean:: ModuleItem ( ref m) => {
1268
- ( m. items . len ( ) == 0 && it. doc_value ( ) . is_none ( ) ) ||
1269
- ( self . passes . contains ( "strip-private" ) && it. visibility != Some ( ast:: Public ) )
1270
- }
1271
- clean:: PrimitiveItem ( ..) => it. visibility != Some ( ast:: Public ) ,
1272
- _ => false ,
1273
- }
1274
- }
1275
1233
}
1276
1234
1277
1235
impl < ' a > Item < ' a > {
@@ -1485,7 +1443,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
1485
1443
try!( document ( w, item) ) ;
1486
1444
1487
1445
let mut indices = range ( 0 , items. len ( ) ) . filter ( |i| {
1488
- !cx . ignore_private_item ( & items[ * i] )
1446
+ !ignore_private_item ( & items[ * i] )
1489
1447
} ) . collect :: < Vec < uint > > ( ) ;
1490
1448
1491
1449
fn cmp ( i1 : & clean:: Item , i2 : & clean:: Item , idx1 : uint , idx2 : uint ) -> Ordering {
@@ -2199,6 +2157,29 @@ impl<'a> fmt::Show for Sidebar<'a> {
2199
2157
}
2200
2158
}
2201
2159
2160
+ fn build_sidebar ( m : & clean:: Module ) -> HashMap < String , Vec < String > > {
2161
+ let mut map = HashMap :: new ( ) ;
2162
+ for item in m. items . iter ( ) {
2163
+ if ignore_private_item ( item) { continue }
2164
+
2165
+ let short = shortty ( item) . to_static_str ( ) ;
2166
+ let myname = match item. name {
2167
+ None => continue ,
2168
+ Some ( ref s) => s. to_string ( ) ,
2169
+ } ;
2170
+ let v = match map. entry ( short. to_string ( ) ) {
2171
+ Vacant ( entry) => entry. set ( Vec :: with_capacity ( 1 ) ) ,
2172
+ Occupied ( entry) => entry. into_mut ( ) ,
2173
+ } ;
2174
+ v. push ( myname) ;
2175
+ }
2176
+
2177
+ for ( _, items) in map. iter_mut ( ) {
2178
+ items. as_mut_slice ( ) . sort ( ) ;
2179
+ }
2180
+ return map;
2181
+ }
2182
+
2202
2183
impl < ' a > fmt:: Show for Source < ' a > {
2203
2184
fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
2204
2185
let Source ( s) = * self ;
@@ -2233,6 +2214,17 @@ fn item_primitive(w: &mut fmt::Formatter,
2233
2214
render_methods ( w, it)
2234
2215
}
2235
2216
2217
+ fn ignore_private_item ( it : & clean:: Item ) -> bool {
2218
+ match it. inner {
2219
+ clean:: ModuleItem ( ref m) => {
2220
+ ( m. items . len ( ) == 0 && it. doc_value ( ) . is_none ( ) ) ||
2221
+ it. visibility != Some ( ast:: Public )
2222
+ }
2223
+ clean:: PrimitiveItem ( ..) => it. visibility != Some ( ast:: Public ) ,
2224
+ _ => false ,
2225
+ }
2226
+ }
2227
+
2236
2228
fn get_basic_keywords ( ) -> & ' static str {
2237
2229
"rust, rustlang, rust-lang"
2238
2230
}
0 commit comments