From 1203257c138e1a02a6180f43bbaebb357e902754 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 12 Apr 2018 09:04:46 +0300 Subject: [PATCH 1/2] Minor simplification --- src/cargo/ops/cargo_install.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/cargo/ops/cargo_install.rs b/src/cargo/ops/cargo_install.rs index 0a784780de3..31aba409f53 100644 --- a/src/cargo/ops/cargo_install.rs +++ b/src/cargo/ops/cargo_install.rs @@ -224,14 +224,7 @@ fn install_one( Some(Filesystem::new(config.cwd().join("target-install"))) }; - let ws = match overidden_target_dir { - Some(dir) => Workspace::ephemeral(pkg, config, Some(dir), false)?, - None => { - let mut ws = Workspace::new(pkg.manifest_path(), config)?; - ws.set_require_optional_deps(false); - ws - } - }; + let ws = Workspace::ephemeral(pkg, config, overidden_target_dir, false)?; let pkg = ws.current()?; if from_cwd { From d86d50cd6751417bc77bb829d45db1ca63ef5123 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 12 Apr 2018 09:06:09 +0300 Subject: [PATCH 2/2] Cleanup formatting --- src/cargo/ops/cargo_install.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/cargo/ops/cargo_install.rs b/src/cargo/ops/cargo_install.rs index 31aba409f53..fde665eabf8 100644 --- a/src/cargo/ops/cargo_install.rs +++ b/src/cargo/ops/cargo_install.rs @@ -229,18 +229,17 @@ fn install_one( if from_cwd { match pkg.manifest().edition() { - Edition::Edition2015 => - config.shell().warn("To build the current package use `cargo build`, to install the current package run `cargo install --path .`")? - , - Edition::Edition2018 => - bail!( - "To build the current package use `cargo build`, \ - to install the current package run `cargo install --path .`, \ - otherwise specify a crate to install from \ - crates.io, or use --path or --git to \ - specify alternate source" - ) - , + Edition::Edition2015 => config.shell().warn( + "To build the current package use `cargo build`, \ + to install the current package run `cargo install --path .`", + )?, + Edition::Edition2018 => bail!( + "To build the current package use `cargo build`, \ + to install the current package run `cargo install --path .`, \ + otherwise specify a crate to install from \ + crates.io, or use --path or --git to \ + specify alternate source" + ), } };