diff --git a/src/libstd/env.rs b/src/libstd/env.rs index facf33de6bb..fe379208774 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -66,7 +66,7 @@ pub fn current_dir() -> io::Result { /// println!("Successfully changed working directory to {}!", root.display()); /// ``` #[stable(feature = "env", since = "1.0.0")] -pub fn set_current_dir + ?Sized>(p: &P) -> io::Result<()> { +pub fn set_current_dir>(p: P) -> io::Result<()> { os_imp::chdir(p.as_ref()) } @@ -175,7 +175,7 @@ fn size_hint(&self) -> (usize, Option) { self.inner.size_hint() } /// } /// ``` #[stable(feature = "env", since = "1.0.0")] -pub fn var(key: &K) -> Result where K: AsRef { +pub fn var>(key: K) -> Result { match var_os(key) { Some(s) => s.into_string().map_err(VarError::NotUnicode), None => Err(VarError::NotPresent) @@ -197,7 +197,7 @@ pub fn var(key: &K) -> Result where K: AsRef /// } /// ``` #[stable(feature = "env", since = "1.0.0")] -pub fn var_os(key: &K) -> Option where K: AsRef { +pub fn var_os>(key: K) -> Option { let _g = ENV_LOCK.lock(); os_imp::getenv(key.as_ref()) } @@ -253,9 +253,7 @@ fn description(&self) -> &str { /// assert_eq!(env::var(key), Ok("VALUE".to_string())); /// ``` #[stable(feature = "env", since = "1.0.0")] -pub fn set_var(k: &K, v: &V) - where K: AsRef, V: AsRef -{ +pub fn set_var, V: AsRef>(k: K, v: V) { let _g = ENV_LOCK.lock(); os_imp::setenv(k.as_ref(), v.as_ref()) } @@ -275,7 +273,7 @@ pub fn set_var(k: &K, v: &V) /// assert!(env::var(key).is_err()); /// ``` #[stable(feature = "env", since = "1.0.0")] -pub fn remove_var(k: &K) where K: AsRef { +pub fn remove_var>(k: K) { let _g = ENV_LOCK.lock(); os_imp::unsetenv(k.as_ref()) }