diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-30 11:00:05 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-31 15:49:57 -0700 |
| commit | d4a2c941809f303b97d153e06ba07e95cd245f88 (patch) | |
| tree | f876f056ff60aeac3f0098deb2dbe1fabfd13091 /src/libstd/sys/windows/os.rs | |
| parent | d754722a04b99fdcae0fd97fa2a4395521145ef2 (diff) | |
| download | rust-d4a2c941809f303b97d153e06ba07e95cd245f88.tar.gz rust-d4a2c941809f303b97d153e06ba07e95cd245f88.zip | |
std: Clean out #[deprecated] APIs
This commit cleans out a large amount of deprecated APIs from the standard library and some of the facade crates as well, updating all users in the compiler and in tests as it goes along.
Diffstat (limited to 'src/libstd/sys/windows/os.rs')
| -rw-r--r-- | src/libstd/sys/windows/os.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index 167db1e8ac2..1ebd4c571ac 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -16,7 +16,7 @@ use prelude::v1::*; use os::windows::prelude::*; use error::Error as StdError; -use ffi::{OsString, OsStr, AsOsStr}; +use ffi::{OsString, OsStr}; use fmt; use io; use libc::types::os::arch::extra::LPWCH; @@ -199,13 +199,13 @@ impl<'a> Iterator for SplitPaths<'a> { pub struct JoinPathsError; pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError> - where I: Iterator<Item=T>, T: AsOsStr + where I: Iterator<Item=T>, T: AsRef<OsStr> { let mut joined = Vec::new(); let sep = b';' as u16; for (i, path) in paths.enumerate() { - let path = path.as_os_str(); + let path = path.as_ref(); if i > 0 { joined.push(sep) } let v = path.encode_wide().collect::<Vec<u16>>(); if v.contains(&(b'"' as u16)) { @@ -245,7 +245,8 @@ pub fn getcwd() -> io::Result<PathBuf> { } pub fn chdir(p: &path::Path) -> io::Result<()> { - let mut p = p.as_os_str().encode_wide().collect::<Vec<_>>(); + let p: &OsStr = p.as_ref(); + let mut p = p.encode_wide().collect::<Vec<_>>(); p.push(0); unsafe { @@ -361,8 +362,8 @@ pub fn temp_dir() -> PathBuf { } pub fn home_dir() -> Option<PathBuf> { - getenv("HOME".as_os_str()).or_else(|| { - getenv("USERPROFILE".as_os_str()) + getenv("HOME".as_ref()).or_else(|| { + getenv("USERPROFILE".as_ref()) }).map(PathBuf::from).or_else(|| unsafe { let me = c::GetCurrentProcess(); let mut token = ptr::null_mut(); |
