@@ -18,61 +18,65 @@ use fold;
1818use fold:: StripItem ;
1919
2020mod collapse_docs;
21- pub use self :: collapse_docs:: collapse_docs ;
21+ pub use self :: collapse_docs:: COLLAPSE_DOCS ;
2222
2323mod strip_hidden;
24- pub use self :: strip_hidden:: strip_hidden ;
24+ pub use self :: strip_hidden:: STRIP_HIDDEN ;
2525
2626mod strip_private;
27- pub use self :: strip_private:: strip_private ;
27+ pub use self :: strip_private:: STRIP_PRIVATE ;
2828
2929mod strip_priv_imports;
30- pub use self :: strip_priv_imports:: strip_priv_imports ;
30+ pub use self :: strip_priv_imports:: STRIP_PRIV_IMPORTS ;
3131
3232mod unindent_comments;
33- pub use self :: unindent_comments:: unindent_comments ;
33+ pub use self :: unindent_comments:: UNINDENT_COMMENTS ;
3434
3535mod propagate_doc_cfg;
36- pub use self :: propagate_doc_cfg:: propagate_doc_cfg ;
36+ pub use self :: propagate_doc_cfg:: PROPAGATE_DOC_CFG ;
3737
38- type Pass = (
39- & ' static str , // name
40- fn ( clean:: Crate ) -> clean:: Crate , // fn
41- & ' static str ,
42- ) ; // description
38+ #[ derive( Copy , Clone , Debug ) ]
39+ pub enum Pass {
40+ LatePass {
41+ name : & ' static str ,
42+ pass : fn ( clean:: Crate ) -> clean:: Crate ,
43+ description : & ' static str ,
44+ }
45+ }
46+
47+ impl Pass {
48+ pub const fn late ( name : & ' static str ,
49+ pass : fn ( clean:: Crate ) -> clean:: Crate ,
50+ description : & ' static str ) -> Pass {
51+ Pass :: LatePass { name, pass, description }
52+ }
53+
54+ pub fn name ( self ) -> & ' static str {
55+ match self {
56+ Pass :: LatePass { name, .. } => name,
57+ }
58+ }
59+
60+ pub fn description ( self ) -> & ' static str {
61+ match self {
62+ Pass :: LatePass { description, .. } => description,
63+ }
64+ }
65+
66+ pub fn late_fn ( self ) -> Option < fn ( clean:: Crate ) -> clean:: Crate > {
67+ match self {
68+ Pass :: LatePass { pass, .. } => Some ( pass) ,
69+ }
70+ }
71+ }
4372
4473pub const PASSES : & ' static [ Pass ] = & [
45- (
46- "strip-hidden" ,
47- strip_hidden,
48- "strips all doc(hidden) items from the output" ,
49- ) ,
50- (
51- "unindent-comments" ,
52- unindent_comments,
53- "removes excess indentation on comments in order for markdown to like it" ,
54- ) ,
55- (
56- "collapse-docs" ,
57- collapse_docs,
58- "concatenates all document attributes into one document attribute" ,
59- ) ,
60- (
61- "strip-private" ,
62- strip_private,
63- "strips all private items from a crate which cannot be seen externally, \
64- implies strip-priv-imports",
65- ) ,
66- (
67- "strip-priv-imports" ,
68- strip_priv_imports,
69- "strips all private import statements (`use`, `extern crate`) from a crate" ,
70- ) ,
71- (
72- "propagate-doc-cfg" ,
73- propagate_doc_cfg,
74- "propagates `#[doc(cfg(...))]` to child items" ,
75- ) ,
74+ STRIP_HIDDEN ,
75+ UNINDENT_COMMENTS ,
76+ COLLAPSE_DOCS ,
77+ STRIP_PRIVATE ,
78+ STRIP_PRIV_IMPORTS ,
79+ PROPAGATE_DOC_CFG ,
7680] ;
7781
7882pub const DEFAULT_PASSES : & ' static [ & ' static str ] = & [
0 commit comments