diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-23 15:09:05 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-23 15:09:05 -0700 |
| commit | fd13400627108fbf3998545f782ed44422e344bf (patch) | |
| tree | 209af0ca5850ae4c2add0da4b278fa908032be63 /src/libstd/sys | |
| parent | c77af69a3793bc0c3c49b05ceffb15dccf5ed4d0 (diff) | |
| parent | 8389253df0431e58bfe0a8e0e3949d58ebe7400f (diff) | |
| download | rust-fd13400627108fbf3998545f782ed44422e344bf.tar.gz rust-fd13400627108fbf3998545f782ed44422e344bf.zip | |
rollup merge of #23538: aturon/conversion
Conflicts: src/librustc_back/rpath.rs
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/fs2.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sys/unix/os.rs | 8 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/libstd/sys/unix/fs2.rs b/src/libstd/sys/unix/fs2.rs index ea74aab3331..202e5ddaec4 100644 --- a/src/libstd/sys/unix/fs2.rs +++ b/src/libstd/sys/unix/fs2.rs @@ -338,8 +338,7 @@ pub fn readlink(p: &Path) -> io::Result<PathBuf> { })); buf.set_len(n as usize); } - let s: OsString = OsStringExt::from_vec(buf); - Ok(PathBuf::new(&s)) + Ok(PathBuf::from(OsString::from_vec(buf))) } pub fn symlink(src: &Path, dst: &Path) -> io::Result<()> { diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index a5a2f71acb7..6c191689255 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -36,7 +36,7 @@ const BUF_BYTES: usize = 2048; const TMPBUF_SZ: usize = 128; fn bytes2path(b: &[u8]) -> PathBuf { - PathBuf::new(<OsStr as OsStrExt>::from_bytes(b)) + PathBuf::from(<OsStr as OsStrExt>::from_bytes(b)) } fn os2path(os: OsString) -> PathBuf { @@ -253,7 +253,7 @@ pub fn current_exe() -> io::Result<PathBuf> { let err = _NSGetExecutablePath(v.as_mut_ptr() as *mut i8, &mut sz); if err != 0 { return Err(io::Error::last_os_error()); } v.set_len(sz as uint - 1); // chop off trailing NUL - Ok(PathBuf::new(OsString::from_vec(v))) + Ok(PathBuf::from(OsString::from_vec(v))) } } @@ -466,9 +466,9 @@ pub fn page_size() -> usize { pub fn temp_dir() -> PathBuf { getenv("TMPDIR".as_os_str()).map(os2path).unwrap_or_else(|| { if cfg!(target_os = "android") { - PathBuf::new("/data/local/tmp") + PathBuf::from("/data/local/tmp") } else { - PathBuf::new("/tmp") + PathBuf::from("/tmp") } }) } |
