Skip to content

Commit dd3ac41

Browse files
committed
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`).
2 parents c145692 + 14fc9dc commit dd3ac41

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

library/std/src/sys_common/process.rs

-16
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,6 @@ impl CommandEnv {
3939
result
4040
}
4141

42-
// Apply these changes directly to the current environment
43-
pub fn apply(&self) {
44-
if self.clear {
45-
for (k, _) in env::vars_os() {
46-
env::remove_var(k);
47-
}
48-
}
49-
for (key, maybe_val) in self.vars.iter() {
50-
if let Some(ref val) = maybe_val {
51-
env::set_var(key, val);
52-
} else {
53-
env::remove_var(key);
54-
}
55-
}
56-
}
57-
5842
pub fn is_unchanged(&self) -> bool {
5943
!self.clear && self.vars.is_empty()
6044
}

0 commit comments

Comments
 (0)