///
/// Discussion of this unsafety on Unix may be found in:
///
-/// - [Austin Group Bugzilla](http://austingroupbugs.net/view.php?id=188)
+/// - [Austin Group Bugzilla](https://austingroupbugs.net/view.php?id=188)
/// - [GNU C library Bugzilla](https://sourceware.org/bugzilla/show_bug.cgi?id=15607#c2)
///
/// # Panics
/// assert_eq!(env::var(key), Ok("VALUE".to_string()));
/// ```
#[stable(feature = "env", since = "1.0.0")]
-pub fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(k: K, v: V) {
- _set_var(k.as_ref(), v.as_ref())
+pub fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
+ _set_var(key.as_ref(), value.as_ref())
}
-fn _set_var(k: &OsStr, v: &OsStr) {
- os_imp::setenv(k, v).unwrap_or_else(|e| {
- panic!("failed to set environment variable `{:?}` to `{:?}`: {}", k, v, e)
+fn _set_var(key: &OsStr, value: &OsStr) {
+ os_imp::setenv(key, value).unwrap_or_else(|e| {
+ panic!("failed to set environment variable `{:?}` to `{:?}`: {}", key, value, e)
})
}
///
/// Discussion of this unsafety on Unix may be found in:
///
-/// - [Austin Group Bugzilla](http://austingroupbugs.net/view.php?id=188)
+/// - [Austin Group Bugzilla](https://austingroupbugs.net/view.php?id=188)
/// - [GNU C library Bugzilla](https://sourceware.org/bugzilla/show_bug.cgi?id=15607#c2)
///
/// # Panics
/// assert!(env::var(key).is_err());
/// ```
#[stable(feature = "env", since = "1.0.0")]
-pub fn remove_var<K: AsRef<OsStr>>(k: K) {
- _remove_var(k.as_ref())
+pub fn remove_var<K: AsRef<OsStr>>(key: K) {
+ _remove_var(key.as_ref())
}
-fn _remove_var(k: &OsStr) {
- os_imp::unsetenv(k)
- .unwrap_or_else(|e| panic!("failed to remove environment variable `{:?}`: {}", k, e))
+fn _remove_var(key: &OsStr) {
+ os_imp::unsetenv(key)
+ .unwrap_or_else(|e| panic!("failed to remove environment variable `{:?}`: {}", key, e))
}
/// An iterator that splits an environment variable into paths according to