diff options
| author | bors <bors@rust-lang.org> | 2019-10-04 05:42:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-10-04 05:42:25 +0000 |
| commit | b824f021d61ddee59695f20c7128c39d80e9e5b6 (patch) | |
| tree | 749bfda71641ec19e8a022fd1601619df970c9e0 | |
| parent | 737f0a6bb508706b75e21194e3010aa3865e779a (diff) | |
| parent | 248251b3b26c5f21e2c2f5bfa5d85cc17b13fc05 (diff) | |
| download | rust-b824f021d61ddee59695f20c7128c39d80e9e5b6.tar.gz rust-b824f021d61ddee59695f20c7128c39d80e9e5b6.zip | |
Auto merge of #4624 - sinkuu:workaround_cargo, r=llogiq
Workaround cargo issue on appveyor Use absolute paths for `cargo` and `rustfmt` to workaround https://github.com/rust-lang/cargo/issues/7475. Appveyor passed on my fork: https://ci.appveyor.com/project/sinkuu/rust-clippy/builds/27870367 changelog: none
| -rw-r--r-- | clippy_dev/Cargo.toml | 2 | ||||
| -rw-r--r-- | clippy_dev/src/fmt.rs | 15 |
2 files changed, 14 insertions, 3 deletions
diff --git a/clippy_dev/Cargo.toml b/clippy_dev/Cargo.toml index e2e946d06f2..de56e4b05c9 100644 --- a/clippy_dev/Cargo.toml +++ b/clippy_dev/Cargo.toml @@ -11,3 +11,5 @@ regex = "1" lazy_static = "1.0" shell-escape = "0.1" walkdir = "2" +# FIXME: remove this once cargo issue #7475 is fixed +home = "0.5" diff --git a/clippy_dev/src/fmt.rs b/clippy_dev/src/fmt.rs index 9f0b68baf9d..1f4925db1be 100644 --- a/clippy_dev/src/fmt.rs +++ b/clippy_dev/src/fmt.rs @@ -140,13 +140,13 @@ fn cargo_fmt(context: &FmtContext, path: &Path) -> Result<bool, CliError> { args.push("--"); args.push("--check"); } - let success = exec(context, "cargo", path, &args)?; + let success = exec(context, &bin_path("cargo"), path, &args)?; Ok(success) } fn rustfmt_test(context: &FmtContext) -> Result<(), CliError> { - let program = "rustfmt"; + let program = bin_path("rustfmt"); let dir = std::env::current_dir()?; let args = &["+nightly", "--version"]; @@ -173,7 +173,7 @@ fn rustfmt(context: &FmtContext, path: &Path) -> Result<bool, CliError> { if context.check { args.push("--check".as_ref()); } - let success = exec(context, "rustfmt", std::env::current_dir()?, &args)?; + let success = exec(context, &bin_path("rustfmt"), std::env::current_dir()?, &args)?; if !success { eprintln!("rustfmt failed on {}", path.display()); } @@ -198,3 +198,12 @@ fn project_root() -> Result<PathBuf, CliError> { Err(CliError::ProjectRootNotFound) } + +// Workaround for https://github.com/rust-lang/cargo/issues/7475. +// FIXME: replace `&bin_path("command")` with `"command"` once the issue is fixed +fn bin_path(bin: &str) -> String { + let mut p = home::cargo_home().unwrap(); + p.push("bin"); + p.push(bin); + p.display().to_string() +} |
