@@ -91,39 +91,14 @@ pub mod test;
91
91
92
92
use clean:: Attributes ;
93
93
94
- type Pass = ( & ' static str , // name
95
- fn ( clean:: Crate ) -> plugins:: PluginResult , // fn
96
- & ' static str ) ; // description
97
-
98
- const PASSES : & ' static [ Pass ] = & [
99
- ( "strip-hidden" , passes:: strip_hidden,
100
- "strips all doc(hidden) items from the output" ) ,
101
- ( "unindent-comments" , passes:: unindent_comments,
102
- "removes excess indentation on comments in order for markdown to like it" ) ,
103
- ( "collapse-docs" , passes:: collapse_docs,
104
- "concatenates all document attributes into one document attribute" ) ,
105
- ( "strip-private" , passes:: strip_private,
106
- "strips all private items from a crate which cannot be seen externally, \
107
- implies strip-priv-imports") ,
108
- ( "strip-priv-imports" , passes:: strip_priv_imports,
109
- "strips all private import statements (`use`, `extern crate`) from a crate" ) ,
110
- ] ;
111
-
112
- const DEFAULT_PASSES : & ' static [ & ' static str ] = & [
113
- "strip-hidden" ,
114
- "strip-private" ,
115
- "collapse-docs" ,
116
- "unindent-comments" ,
117
- ] ;
118
-
119
94
struct Output {
120
95
krate : clean:: Crate ,
121
96
renderinfo : html:: render:: RenderInfo ,
122
97
passes : Vec < String > ,
123
98
}
124
99
125
100
pub fn main ( ) {
126
- const STACK_SIZE : usize = 32000000 ; // 32MB
101
+ const STACK_SIZE : usize = 32_000_000 ; // 32MB
127
102
let res = std:: thread:: Builder :: new ( ) . stack_size ( STACK_SIZE ) . spawn ( move || {
128
103
let s = env:: args ( ) . collect :: < Vec < _ > > ( ) ;
129
104
main_args ( & s)
@@ -223,11 +198,11 @@ pub fn main_args(args: &[String]) -> isize {
223
198
224
199
if matches. opt_strs ( "passes" ) == [ "list" ] {
225
200
println ! ( "Available passes for running rustdoc:" ) ;
226
- for & ( name, _, description) in PASSES {
201
+ for & ( name, _, description) in passes :: PASSES {
227
202
println ! ( "{:>20} - {}" , name, description) ;
228
203
}
229
204
println ! ( "\n Default passes for rustdoc:" ) ;
230
- for & name in DEFAULT_PASSES {
205
+ for & name in passes :: DEFAULT_PASSES {
231
206
println ! ( "{:>20}" , name) ;
232
207
}
233
208
return 0 ;
@@ -236,7 +211,8 @@ pub fn main_args(args: &[String]) -> isize {
236
211
if matches. free . is_empty ( ) {
237
212
println ! ( "expected an input file to act on" ) ;
238
213
return 1 ;
239
- } if matches. free . len ( ) > 1 {
214
+ }
215
+ if matches. free . len ( ) > 1 {
240
216
println ! ( "only one input file may be specified" ) ;
241
217
return 1 ;
242
218
}
@@ -412,7 +388,7 @@ fn rust_input(cratefile: &str, externs: Externs, matches: &getopts::Matches) ->
412
388
}
413
389
414
390
if default_passes {
415
- for name in DEFAULT_PASSES . iter ( ) . rev ( ) {
391
+ for name in passes :: DEFAULT_PASSES . iter ( ) . rev ( ) {
416
392
passes. insert ( 0 , name. to_string ( ) ) ;
417
393
}
418
394
}
@@ -422,11 +398,11 @@ fn rust_input(cratefile: &str, externs: Externs, matches: &getopts::Matches) ->
422
398
. unwrap_or ( "/tmp/rustdoc/plugins" . to_string ( ) ) ;
423
399
let mut pm = plugins:: PluginManager :: new ( PathBuf :: from ( path) ) ;
424
400
for pass in & passes {
425
- let plugin = match PASSES . iter ( )
426
- . position ( |& ( p, ..) | {
427
- p == * pass
428
- } ) {
429
- Some ( i) => PASSES [ i] . 1 ,
401
+ let plugin = match passes :: PASSES . iter ( )
402
+ . position ( |& ( p, ..) | {
403
+ p == * pass
404
+ } ) {
405
+ Some ( i) => passes :: PASSES [ i] . 1 ,
430
406
None => {
431
407
error ! ( "unknown pass {}, skipping" , * pass) ;
432
408
continue
0 commit comments