use clean::Attributes;
-type Pass = (&'static str, // name
- fn(clean::Crate) -> plugins::PluginResult, // fn
- &'static str); // description
-
-const PASSES: &'static [Pass] = &[
- ("strip-hidden", passes::strip_hidden,
- "strips all doc(hidden) items from the output"),
- ("unindent-comments", passes::unindent_comments,
- "removes excess indentation on comments in order for markdown to like it"),
- ("collapse-docs", passes::collapse_docs,
- "concatenates all document attributes into one document attribute"),
- ("strip-private", passes::strip_private,
- "strips all private items from a crate which cannot be seen externally, \
- implies strip-priv-imports"),
- ("strip-priv-imports", passes::strip_priv_imports,
- "strips all private import statements (`use`, `extern crate`) from a crate"),
-];
-
-const DEFAULT_PASSES: &'static [&'static str] = &[
- "strip-hidden",
- "strip-private",
- "collapse-docs",
- "unindent-comments",
-];
-
struct Output {
krate: clean::Crate,
renderinfo: html::render::RenderInfo,
if matches.opt_strs("passes") == ["list"] {
println!("Available passes for running rustdoc:");
- for &(name, _, description) in PASSES {
+ for &(name, _, description) in passes::PASSES {
println!("{:>20} - {}", name, description);
}
println!("\nDefault passes for rustdoc:");
- for &name in DEFAULT_PASSES {
+ for &name in passes::DEFAULT_PASSES {
println!("{:>20}", name);
}
return 0;
}
if default_passes {
- for name in DEFAULT_PASSES.iter().rev() {
+ for name in passes::DEFAULT_PASSES.iter().rev() {
passes.insert(0, name.to_string());
}
}
.unwrap_or("/tmp/rustdoc/plugins".to_string());
let mut pm = plugins::PluginManager::new(PathBuf::from(path));
for pass in &passes {
- let plugin = match PASSES.iter()
- .position(|&(p, ..)| {
- p == *pass
- }) {
- Some(i) => PASSES[i].1,
+ let plugin = match passes::PASSES.iter()
+ .position(|&(p, ..)| {
+ p == *pass
+ }) {
+ Some(i) => passes::PASSES[i].1,
None => {
error!("unknown pass {}, skipping", *pass);
continue
use clean::{self, GetDefId, Item};
use fold;
use fold::FoldItem::Strip;
+use plugins;
mod collapse_docs;
pub use self::collapse_docs::collapse_docs;
mod unindent_comments;
pub use self::unindent_comments::unindent_comments;
+type Pass = (&'static str, // name
+ fn(clean::Crate) -> plugins::PluginResult, // fn
+ &'static str); // description
+
+pub const PASSES: &'static [Pass] = &[
+ ("strip-hidden", strip_hidden,
+ "strips all doc(hidden) items from the output"),
+ ("unindent-comments", unindent_comments,
+ "removes excess indentation on comments in order for markdown to like it"),
+ ("collapse-docs", collapse_docs,
+ "concatenates all document attributes into one document attribute"),
+ ("strip-private", strip_private,
+ "strips all private items from a crate which cannot be seen externally, \
+ implies strip-priv-imports"),
+ ("strip-priv-imports", strip_priv_imports,
+ "strips all private import statements (`use`, `extern crate`) from a crate"),
+];
+
+pub const DEFAULT_PASSES: &'static [&'static str] = &[
+ "strip-hidden",
+ "strip-private",
+ "collapse-docs",
+ "unindent-comments",
+];
+
+
struct Stripper<'a> {
retained: &'a mut DefIdSet,
access_levels: &'a AccessLevels<DefId>,