diff --git a/build.rs b/build.rs index ac879ce..7463c5e 100644 --- a/build.rs +++ b/build.rs @@ -69,14 +69,15 @@ fn compile_probe() -> Option { fs::write(&probefile, PROBE).ok()?; // Make sure to pick up Cargo rustc configuration. - let mut cmd = if let Some(wrapper) = env::var_os("CARGO_RUSTC_WRAPPER") { - let mut cmd = Command::new(wrapper); - // The wrapper's first argument should always be the path to rustc. - cmd.arg(rustc); - cmd - } else { - Command::new(rustc) - }; + let mut cmd = env::var_os("CARGO_RUSTC_WRAPPER").map_or_else( + || Command::new(&rustc), + |wrapper| { + let mut cmd = Command::new(wrapper); + // The wrapper's first argument should always be the path to rustc. + cmd.arg(&rustc); + cmd + }, + ); cmd.stderr(Stdio::null()) .arg("--edition=2018")