Skip to content

Commit

Permalink
Fix --target-dir option
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Nov 13, 2019
1 parent c0db67a commit 1391842
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ fn try_main(coloring: &mut Option<Coloring>) -> Result<()> {
fn exec_on_workspace(args: &Args, current_manifest: &Manifest, metadata: &Metadata) -> Result<()> {
let mut line = ProcessBuilder::from_args(cargo_binary(), &args);

line.arg("--target-dir");
line.arg(args.target_dir.as_ref().unwrap_or(&metadata.target_directory));
if let Some(target_dir) = &args.target_dir {
line.arg("--target-dir");
line.arg(target_dir);
}

if let Some(color) = args.color {
line.arg("--color");
Expand Down
2 changes: 0 additions & 2 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ use crate::Args;
pub(crate) struct Metadata {
/// A list of all crates referenced by this crate (and the crate itself)
pub(crate) packages: Vec<Package>,
/// Build directory
pub(crate) target_directory: PathBuf,
/// Workspace root
pub(crate) workspace_root: PathBuf,
}
Expand Down
4 changes: 2 additions & 2 deletions src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ impl fmt::Display for ProcessBuilder {
} else {
let mut args = self.args.iter();
while let Some(arg) = args.next() {
// Displaying `--target-dir` and `--manifest-path` is redundant.
if arg == "--target-dir" || arg == "--manifest-path" {
// Displaying `--manifest-path` is redundant.
if arg == "--manifest-path" {
let _ = args.next();
continue;
}
Expand Down

0 comments on commit 1391842

Please sign in to comment.