diff options
Diffstat (limited to 'src/libcore/os.rs')
| -rw-r--r-- | src/libcore/os.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 9aa00e8e457..e93888f3eaf 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -517,7 +517,7 @@ pub fn homedir() -> Option<Path> { #[cfg(windows)] fn secondary() -> Option<Path> { - do option::chain(getenv(~"USERPROFILE")) |p| { + do getenv(~"USERPROFILE").chain |p| { if !str::is_empty(p) { Some(Path(p)) } else { @@ -555,19 +555,16 @@ pub fn tmpdir() -> Path { #[cfg(unix)] #[allow(non_implicitly_copyable_typarams)] fn lookup() -> Path { - option::get_or_default(getenv_nonempty("TMPDIR"), - Path("/tmp")) + getenv_nonempty("TMPDIR").get_or_default(Path("/tmp")) } #[cfg(windows)] #[allow(non_implicitly_copyable_typarams)] fn lookup() -> Path { - option::get_or_default( - option::or(getenv_nonempty("TMP"), - option::or(getenv_nonempty("TEMP"), - option::or(getenv_nonempty("USERPROFILE"), - getenv_nonempty("WINDIR")))), - Path("C:\\Windows")) + getenv_nonempty("TMP").or( + getenv_nonempty("TEMP").or( + getenv_nonempty("USERPROFILE").or( + getenv_nonempty("WINDIR")))).get_or_default(Path("C:\\Windows")) } } /// Recursively walk a directory structure |
