about summary refs log tree commit diff
path: root/src/libstd/process.rs
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/process.rs
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/process.rs')
-rw-r--r--src/libstd/process.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index ebd0820669c..c344cbe0862 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -147,7 +147,7 @@ impl Command {
     /// Builder methods are provided to change these defaults and
     /// otherwise configure the process.
     #[stable(feature = "process", since = "1.0.0")]
-    pub fn new<S: AsOsStr + ?Sized>(program: &S) -> Command {
+    pub fn new<S: AsOsStr>(program: S) -> Command {
         Command {
             inner: CommandImp::new(program.as_os_str()),
             stdin: None,
@@ -158,7 +158,7 @@ impl Command {
 
     /// Add an argument to pass to the program.
     #[stable(feature = "process", since = "1.0.0")]
-    pub fn arg<S: AsOsStr + ?Sized>(&mut self, arg: &S) -> &mut Command {
+    pub fn arg<S: AsOsStr>(&mut self, arg: S) -> &mut Command {
         self.inner.arg(arg.as_os_str());
         self
     }
@@ -175,7 +175,7 @@ impl Command {
     /// Note that environment variable names are case-insensitive (but case-preserving) on Windows,
     /// and case-sensitive on all other platforms.
     #[stable(feature = "process", since = "1.0.0")]
-    pub fn env<K: ?Sized, V: ?Sized>(&mut self, key: &K, val: &V) -> &mut Command
+    pub fn env<K, V>(&mut self, key: K, val: V) -> &mut Command
         where K: AsOsStr, V: AsOsStr
     {
         self.inner.env(key.as_os_str(), val.as_os_str());
@@ -184,7 +184,7 @@ impl Command {
 
     /// Removes an environment variable mapping.
     #[stable(feature = "process", since = "1.0.0")]
-    pub fn env_remove<K: ?Sized + AsOsStr>(&mut self, key: &K) -> &mut Command {
+    pub fn env_remove<K: AsOsStr>(&mut self, key: K) -> &mut Command {
         self.inner.env_remove(key.as_os_str());
         self
     }
@@ -198,7 +198,7 @@ impl Command {
 
     /// Set the working directory for the child process.
     #[stable(feature = "process", since = "1.0.0")]
-    pub fn current_dir<P: AsPath + ?Sized>(&mut self, dir: &P) -> &mut Command {
+    pub fn current_dir<P: AsPath>(&mut self, dir: P) -> &mut Command {
         self.inner.cwd(dir.as_path().as_os_str());
         self
     }