Skip to content

Commit

Permalink
Remove only release artifacts in release mode.
Browse files Browse the repository at this point in the history
Closes #33
  • Loading branch information
RazrFalcon committed Jun 20, 2019
1 parent da04eca commit 77f5a1b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,18 @@ fn process_crate(args: &Args) -> Result<CrateData, Error> {
let output = if args.time {
// To collect the build times we have to clean the repo first.

let clean_args = if args.release {
// Remove only `target/release` in the release mode.
vec!["clean", "--release"]
} else {
// We can't remove only `target/debug` in debug mode yet.
// See https://github.com/rust-lang/cargo/pull/6989
vec!["clean"]
};

// No need to check the output status.
let _ = Command::new("cargo")
.arg("clean")
.args(&clean_args)
.output();

Command::new("cargo")
Expand Down

1 comment on commit 77f5a1b

@heidezomp
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this! 👍

Please sign in to comment.