Skip to content

Commit

Permalink
Make --hide-instantiations default
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Dec 28, 2023
1 parent 5295e51 commit d1f89c5
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ OPTIONS:
--ignore-filename-regex <PATTERN>
Skip source code files with file paths that match the given regular expression

--hide-instantiations
Hide instantiations from report
--show-instantiations
Show instantiations in report

--no-cfg-coverage
Unset cfg(coverage), which is enabled when code is built using cargo-llvm-cov
Expand Down
4 changes: 2 additions & 2 deletions docs/cargo-llvm-cov-report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ OPTIONS:
--ignore-filename-regex <PATTERN>
Skip source code files with file paths that match the given regular expression

--hide-instantiations
Hide instantiations from report
--show-instantiations
Show instantiations in report

--fail-under-functions <MIN>
Exit with a status of 1 if the total function coverage is less than MIN percent
Expand Down
4 changes: 2 additions & 2 deletions docs/cargo-llvm-cov-run.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ OPTIONS:
--ignore-filename-regex <PATTERN>
Skip source code files with file paths that match the given regular expression

--hide-instantiations
Hide instantiations from report
--show-instantiations
Show instantiations in report

--no-cfg-coverage
Unset cfg(coverage), which is enabled when code is built using cargo-llvm-cov
Expand Down
4 changes: 2 additions & 2 deletions docs/cargo-llvm-cov-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ OPTIONS:
--ignore-filename-regex <PATTERN>
Skip source code files with file paths that match the given regular expression

--hide-instantiations
Hide instantiations from report
--show-instantiations
Show instantiations in report

--no-cfg-coverage
Unset cfg(coverage), which is enabled when code is built using cargo-llvm-cov
Expand Down
4 changes: 2 additions & 2 deletions docs/cargo-llvm-cov.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ OPTIONS:
--ignore-filename-regex <PATTERN>
Skip source code files with file paths that match the given regular expression

--hide-instantiations
Hide instantiations from report
--show-instantiations
Show instantiations in report

--no-cfg-coverage
Unset cfg(coverage), which is enabled when code is built using cargo-llvm-cov
Expand Down
15 changes: 10 additions & 5 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl Args {
let mut failure_mode = None;
let mut ignore_filename_regex = None;
let mut disable_default_ignore_filename_regex = false;
let mut hide_instantiations = false;
let mut show_instantiations = false;
let mut no_cfg_coverage = false;
let mut no_cfg_coverage_nightly = false;
let mut no_report = false;
Expand Down Expand Up @@ -396,7 +396,12 @@ impl Args {
Long("disable-default-ignore-filename-regex") => {
parse_flag!(disable_default_ignore_filename_regex);
}
Long("hide-instantiations") => parse_flag!(hide_instantiations),
Long("show-instantiations") => parse_flag!(show_instantiations),
Long("hide-instantiations") => {
// The following warning is a hint, so it should not be promoted to an error.
let _guard = term::warn::ignore();
warn!("--hide-instantiations is now enabled by default");
}
Long("no-cfg-coverage") => parse_flag!(no_cfg_coverage),
Long("no-cfg-coverage-nightly") => parse_flag!(no_cfg_coverage_nightly),
Long("no-report") => parse_flag!(no_report),
Expand Down Expand Up @@ -816,7 +821,7 @@ impl Args {
failure_mode,
ignore_filename_regex,
disable_default_ignore_filename_regex,
hide_instantiations,
show_instantiations,
no_cfg_coverage,
no_cfg_coverage_nightly,
no_report,
Expand Down Expand Up @@ -1023,8 +1028,8 @@ pub(crate) struct LlvmCovOptions {
pub(crate) ignore_filename_regex: Option<String>,
// For debugging (unstable)
pub(crate) disable_default_ignore_filename_regex: bool,
/// Hide instantiations from report
pub(crate) hide_instantiations: bool,
/// Show instantiations in report
pub(crate) show_instantiations: bool,
/// Unset cfg(coverage), which is enabled when code is built using cargo-llvm-cov.
pub(crate) no_cfg_coverage: bool,
/// Unset cfg(coverage_nightly), which is enabled when code is built using cargo-llvm-cov and nightly compiler.
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ impl Format {
match self {
Self::Text | Self::Html => {
cmd.args([
&format!("-show-instantiations={}", !cx.args.cov.hide_instantiations),
&format!("-show-instantiations={}", cx.args.cov.show_instantiations),
"-show-line-counts-or-regions",
"-show-expansions",
"-show-branches=count",
Expand Down Expand Up @@ -1076,7 +1076,7 @@ impl Format {
}

fn ignore_filename_regex(cx: &Context) -> Option<String> {
// On windows, we should escape the separator.
// On Windows, we should escape the separator.
const SEPARATOR: &str = if cfg!(windows) { "\\\\" } else { "/" };

#[derive(Default)]
Expand Down
4 changes: 2 additions & 2 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const SUBCOMMANDS: &[&str] = &["", "run", "report", "clean", "show-env", "nextes

fn test_set() -> Vec<(&'static str, &'static [&'static str])> {
vec![
("txt", &["--text"]),
("hide-instantiations.txt", &["--text", "--hide-instantiations"]),
("txt", &["--text", "--show-instantiations"]),
("hide-instantiations.txt", &["--text"]),
("summary.txt", &[]),
("json", &["--json", "--summary-only"]),
// TODO: full JSON output is unstable between platform.
Expand Down

0 comments on commit d1f89c5

Please sign in to comment.