about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-03-15 09:18:42 +0000
committerbors <bors@rust-lang.org>2015-03-15 09:18:42 +0000
commit54660fc392343e4ddee8a0ea1ca196ffc533585b (patch)
treefef688e18277c0011e4d52fe830b24b0c396dedf /src/libstd/sys
parentf59af75bd851b1a80cd2fab5cddd2875dcaf710e (diff)
parent60a4a2db8837be91bdae051bd51ab181077e5dc6 (diff)
downloadrust-54660fc392343e4ddee8a0ea1ca196ffc533585b.tar.gz
rust-54660fc392343e4ddee8a0ea1ca196ffc533585b.zip
Auto merge of #23316 - alexcrichton:less-question-sized, r=aturon
It is a frequent pattern among I/O functions to take `P: AsPath + ?Sized` or
`AsOsStr` instead of `AsPath`. Most of these functions do not need to take
ownership of their argument, but for libraries in general it's much more
ergonomic to not deal with `?Sized` at all and simply require an argument `P`
instead of `&P`.

This change is aimed at removing unsightly `?Sized` bounds while retaining the
same level of usability as before. All affected functions now take ownership of
their arguments instead of taking them by reference, but due to the forwarding
implementations of `AsOsStr` and `AsPath` all code should continue to work as it
did before.

This is strictly speaking a breaking change due to the signatures of these
functions changing, but normal idiomatic usage of these APIs should not break in
practice.

[breaking-change]
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/unix/os.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs
index d332556d188..b0ad9ab6937 100644
--- a/src/libstd/sys/unix/os.rs
+++ b/src/libstd/sys/unix/os.rs
@@ -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>(&OsStringExt::from_vec(v)))
+        Ok(PathBuf::new(OsString::from_vec(v)))
     }
 }