mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
change k to key and v to v in std::env mod
This commit is contained in:
parent
00f2bf40d6
commit
0778e8dcb8
@ -324,13 +324,13 @@ impl Error for VarError {
|
||||
/// 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)
|
||||
})
|
||||
}
|
||||
|
||||
@ -366,13 +366,13 @@ fn _set_var(k: &OsStr, v: &OsStr) {
|
||||
/// 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
|
||||
|
Loading…
Reference in New Issue
Block a user