From: Dylan MacKenzie Date: Fri, 24 Apr 2020 16:19:58 +0000 (-0700) Subject: Only set *FLAGS env vars if they are not empty X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=08c8996ff6f152e2ac580fbabce46e97457185e3;p=rust.git Only set *FLAGS env vars if they are not empty --- diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 466e2d6e799..4a664205bff 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1405,8 +1405,16 @@ pub fn env(&mut self, key: impl AsRef, value: impl AsRef) -> &mut impl From for Command { fn from(mut cargo: Cargo) -> Command { - cargo.command.env("RUSTFLAGS", &cargo.rustflags.0); - cargo.command.env("RUSTDOCFLAGS", &cargo.rustdocflags.0); + let rustflags = &cargo.rustflags.0; + if !rustflags.is_empty() { + cargo.command.env("RUSTFLAGS", rustflags); + } + + let rustdocflags = &cargo.rustdocflags.0; + if !rustdocflags.is_empty() { + cargo.command.env("RUSTDOCFLAGS", rustdocflags); + } + cargo.command } }