about summary refs log tree commit diff
path: root/library/std/src/sys_common
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-01-01 20:45:37 +0000
committerbors <bors@rust-lang.org>2022-01-01 20:45:37 +0000
commitdd3ac41495e85a9b7b5cb3186379d02ce17e51fe (patch)
tree4d3cffb33614ea689814bd0d47a4da860f0992ed /library/std/src/sys_common
parentc145692254e86974941f2c92c643a23df0f13e82 (diff)
parent14fc9dcbba8a92a77074659df2fab2f090204a42 (diff)
downloadrust-dd3ac41495e85a9b7b5cb3186379d02ce17e51fe.tar.gz
rust-dd3ac41495e85a9b7b5cb3186379d02ce17e51fe.zip
Auto merge of #92396 - xfix:remove-commandenv-apply, r=Mark-Simulacrum
Remove CommandEnv::apply

It's not being used and uses unsound set_var and remove_var functions. This is an internal function that isn't exported (even with `process_internals` feature), so this shouldn't break anything.

Also see #92365. Note that this isn't the only use of those methods in standard library, so that particular pull request will need more changes than just this to work (in particular, `test_capture_env_at_spawn` is using `set_var` and `remove_var`).
Diffstat (limited to 'library/std/src/sys_common')
-rw-r--r--library/std/src/sys_common/process.rs16
1 files changed, 0 insertions, 16 deletions
diff --git a/library/std/src/sys_common/process.rs b/library/std/src/sys_common/process.rs
index 2cd1e29f6c4..9f978789a62 100644
--- a/library/std/src/sys_common/process.rs
+++ b/library/std/src/sys_common/process.rs
@@ -39,22 +39,6 @@ impl CommandEnv {
         result
     }
 
-    // Apply these changes directly to the current environment
-    pub fn apply(&self) {
-        if self.clear {
-            for (k, _) in env::vars_os() {
-                env::remove_var(k);
-            }
-        }
-        for (key, maybe_val) in self.vars.iter() {
-            if let Some(ref val) = maybe_val {
-                env::set_var(key, val);
-            } else {
-                env::remove_var(key);
-            }
-        }
-    }
-
     pub fn is_unchanged(&self) -> bool {
         !self.clear && self.vars.is_empty()
     }