]> git.lizzy.rs Git - rust.git/commitdiff
Only set *FLAGS env vars if they are not empty
authorDylan MacKenzie <ecstaticmorse@gmail.com>
Fri, 24 Apr 2020 16:19:58 +0000 (09:19 -0700)
committerDylan MacKenzie <ecstaticmorse@gmail.com>
Fri, 24 Apr 2020 16:19:58 +0000 (09:19 -0700)
src/bootstrap/builder.rs

index 466e2d6e7991942e4199a65baf9802637bfd35b6..4a664205bff0b6afeb32da99512e8cde177be96c 100644 (file)
@@ -1405,8 +1405,16 @@ pub fn env(&mut self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>) -> &mut
 
 impl From<Cargo> 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
     }
 }