add a coverage mode for private items
This commit is contained in:
parent
5eb1ab5265
commit
a3a255990e
2 changed files with 20 additions and 3 deletions
|
|
@ -232,6 +232,10 @@ impl Options {
|
|||
for &name in passes::DEFAULT_COVERAGE_PASSES {
|
||||
println!("{:>20}", name);
|
||||
}
|
||||
println!("\nPasses run with `--show-coverage --document-private-items`:");
|
||||
for &name in passes::PRIVATE_COVERAGE_PASSES {
|
||||
println!("{:>20}", name);
|
||||
}
|
||||
return Err(0);
|
||||
}
|
||||
|
||||
|
|
@ -421,17 +425,21 @@ impl Options {
|
|||
}
|
||||
});
|
||||
|
||||
let show_coverage = matches.opt_present("show-coverage");
|
||||
let document_private = matches.opt_present("document-private-items");
|
||||
|
||||
let default_passes = if matches.opt_present("no-defaults") {
|
||||
passes::DefaultPassOption::None
|
||||
} else if matches.opt_present("show-coverage") {
|
||||
} else if show_coverage && document_private {
|
||||
passes::DefaultPassOption::PrivateCoverage
|
||||
} else if show_coverage {
|
||||
passes::DefaultPassOption::Coverage
|
||||
} else if matches.opt_present("document-private-items") {
|
||||
} else if document_private {
|
||||
passes::DefaultPassOption::Private
|
||||
} else {
|
||||
passes::DefaultPassOption::Default
|
||||
};
|
||||
let manual_passes = matches.opt_strs("passes");
|
||||
let show_coverage = matches.opt_present("show-coverage");
|
||||
|
||||
let crate_name = matches.opt_str("crate-name");
|
||||
let playground_url = matches.opt_str("playground-url");
|
||||
|
|
|
|||
|
|
@ -106,6 +106,13 @@ pub const DEFAULT_COVERAGE_PASSES: &'static [&'static str] = &[
|
|||
"calculate-doc-coverage",
|
||||
];
|
||||
|
||||
/// The list of default passes run when `--doc-coverage --document-private-items` is passed to
|
||||
/// rustdoc.
|
||||
pub const PRIVATE_COVERAGE_PASSES: &'static [&'static str] = &[
|
||||
"collect-trait-impls",
|
||||
"calculate-doc-coverage",
|
||||
];
|
||||
|
||||
/// A shorthand way to refer to which set of passes to use, based on the presence of
|
||||
/// `--no-defaults` or `--document-private-items`.
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
|
|
@ -113,6 +120,7 @@ pub enum DefaultPassOption {
|
|||
Default,
|
||||
Private,
|
||||
Coverage,
|
||||
PrivateCoverage,
|
||||
None,
|
||||
}
|
||||
|
||||
|
|
@ -122,6 +130,7 @@ pub fn defaults(default_set: DefaultPassOption) -> &'static [&'static str] {
|
|||
DefaultPassOption::Default => DEFAULT_PASSES,
|
||||
DefaultPassOption::Private => DEFAULT_PRIVATE_PASSES,
|
||||
DefaultPassOption::Coverage => DEFAULT_COVERAGE_PASSES,
|
||||
DefaultPassOption::PrivateCoverage => PRIVATE_COVERAGE_PASSES,
|
||||
DefaultPassOption::None => &[],
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue