Skip to content

Commit

Permalink
Auto merge of #4641 - sinkuu:revert_workaround, r=phansch
Browse files Browse the repository at this point in the history
Revert "Workaround cargo bug on Windows"

[Cargo is fixed on rust master](rust-lang/rust#65186). This reverts PR #4624.

Fixes #4638

changelog: none
  • Loading branch information
bors committed Oct 8, 2019
2 parents 30a3992 + d2daf8e commit 5cb9833
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
2 changes: 0 additions & 2 deletions clippy_dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ regex = "1"
lazy_static = "1.0"
shell-escape = "0.1"
walkdir = "2"
# FIXME: remove this once cargo issue #7475 is fixed
home = "0.5"
15 changes: 3 additions & 12 deletions clippy_dev/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ fn cargo_fmt(context: &FmtContext, path: &Path) -> Result<bool, CliError> {
args.push("--");
args.push("--check");
}
let success = exec(context, &bin_path("cargo"), path, &args)?;
let success = exec(context, "cargo", path, &args)?;

Ok(success)
}

fn rustfmt_test(context: &FmtContext) -> Result<(), CliError> {
let program = bin_path("rustfmt");
let program = "rustfmt";
let dir = std::env::current_dir()?;
let args = &["+nightly", "--version"];

Expand All @@ -170,7 +170,7 @@ fn rustfmt(context: &FmtContext, path: &Path) -> Result<bool, CliError> {
if context.check {
args.push("--check".as_ref());
}
let success = exec(context, &bin_path("rustfmt"), std::env::current_dir()?, &args)?;
let success = exec(context, "rustfmt", std::env::current_dir()?, &args)?;
if !success {
eprintln!("rustfmt failed on {}", path.display());
}
Expand All @@ -195,12 +195,3 @@ 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()
}

0 comments on commit 5cb9833

Please sign in to comment.