diff --git a/src/env.rs b/src/env.rs index 487c6237b1..0d815be91e 100644 --- a/src/env.rs +++ b/src/env.rs @@ -1,4 +1,3 @@ -use std::env; use {Error, Result}; /// Clear the environment of all name-value pairs. @@ -37,7 +36,10 @@ pub unsafe fn clearenv() -> Result<()> { target_os = "emscripten"))] { ret = libc::clearenv(); } else { - manual_clearenv(); + use std::env; + for (name, _) in env::vars_os() { + env::remove_var(name); + } ret = 0; } } @@ -48,9 +50,3 @@ pub unsafe fn clearenv() -> Result<()> { Err(Error::UnsupportedOperation) } } - -fn manual_clearenv() { - for (name, _) in env::vars_os() { - env::remove_var(name); - } -}