about summary refs log tree commit diff
path: root/library/std/src/sys_common
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-08-12 13:24:29 +0000
committerbors <bors@rust-lang.org>2021-08-12 13:24:29 +0000
commit4498e300e41f47c75abe4e49ec91ae949aaeea5f (patch)
treed63b62629e1256e38245e5e0194de0759ab0a891 /library/std/src/sys_common
parent6bed1f0bc3cc50c10aab26d5f94b16a00776b8a5 (diff)
parentfaf7fb94f9cb7c66ecbc5e922726cabd3016da2d (diff)
downloadrust-4498e300e41f47c75abe4e49ec91ae949aaeea5f.tar.gz
rust-4498e300e41f47c75abe4e49ec91ae949aaeea5f.zip
Auto merge of #87963 - GuillaumeGomez:rollup-e54sbez, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #87819 (Use a more accurate span on assoc types WF checks)
 - #87863 (Fix Windows Command::env("PATH"))
 - #87885 (Link to edition guide instead of issues for 2021 lints.)
 - #87941 (Fix/improve rustdoc-js tool)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src/sys_common')
-rw-r--r--library/std/src/sys_common/process.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/library/std/src/sys_common/process.rs b/library/std/src/sys_common/process.rs
index fe89b11043c..38007d5c414 100644
--- a/library/std/src/sys_common/process.rs
+++ b/library/std/src/sys_common/process.rs
@@ -65,16 +65,18 @@ impl CommandEnv {
 
     // The following functions build up changes
     pub fn set(&mut self, key: &OsStr, value: &OsStr) {
+        let key = EnvKey::from(key);
         self.maybe_saw_path(&key);
-        self.vars.insert(key.to_owned().into(), Some(value.to_owned()));
+        self.vars.insert(key, Some(value.to_owned()));
     }
 
     pub fn remove(&mut self, key: &OsStr) {
+        let key = EnvKey::from(key);
         self.maybe_saw_path(&key);
         if self.clear {
-            self.vars.remove(key);
+            self.vars.remove(&key);
         } else {
-            self.vars.insert(key.to_owned().into(), None);
+            self.vars.insert(key, None);
         }
     }
 
@@ -87,7 +89,7 @@ impl CommandEnv {
         self.saw_path || self.clear
     }
 
-    fn maybe_saw_path(&mut self, key: &OsStr) {
+    fn maybe_saw_path(&mut self, key: &EnvKey) {
         if !self.saw_path && key == "PATH" {
             self.saw_path = true;
         }