From eebae678ffd4f092522b2b10d76f8cdb9ce50eda Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Fri, 18 Jun 2021 12:40:12 -0700 Subject: [PATCH] Fix clippy error --- build.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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")