Skip to content

Commit

Permalink
remove unnecessary rustc env for cargo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yaahc committed Mar 30, 2019
1 parent bccc0ee commit 47c82f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/cargo/core/compiler/build_context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ impl<'a, 'cfg> BuildContext<'a, 'cfg> {
rustc.push_wrapper(RustcWrapper::new(tool));
} else if build_config.cargo_as_rustc_wrapper {
let mut wrapper = RustcWrapper::new(env::current_exe()?);
let prog = rustc.path.as_os_str().to_owned();
wrapper.env("RUSTC", prog);
for (k, v) in build_config.extra_rustc_env.iter() {
wrapper.env(k, v);
}
Expand Down
4 changes: 3 additions & 1 deletion src/cargo/ops/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ pub fn fix_maybe_exec_rustc() -> CargoResult<bool> {

let args = FixArgs::get();
trace!("cargo-fix as rustc got file {:?}", args.file);
let rustc = env::var_os("RUSTC").expect("failed to find RUSTC env var");
let rustc = args.rustc.as_ref().expect("fix wrapper rustc was not set");

// Our goal is to fix only the crates that the end user is interested in.
// That's very likely to only mean the crates in the workspace the user is
Expand Down Expand Up @@ -576,6 +576,7 @@ struct FixArgs {
enabled_edition: Option<String>,
other: Vec<OsString>,
primary_package: bool,
rustc: Option<PathBuf>,
}

enum PrepareFor {
Expand All @@ -593,6 +594,7 @@ impl Default for PrepareFor {
impl FixArgs {
fn get() -> FixArgs {
let mut ret = FixArgs::default();
ret.rustc = env::args_os().nth(1).map(PathBuf::from);
for arg in env::args_os().skip(2) {
let path = PathBuf::from(arg);
if path.extension().and_then(|s| s.to_str()) == Some("rs") && path.exists() {
Expand Down

0 comments on commit 47c82f0

Please sign in to comment.