Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto merge of #15566 : japaric/rust/command-clone, r=alexcrichton
Allows use cases like this one: ``` rust use std::io::Command; fn main() { let mut cmd = Command::new("ls"); cmd.arg("-l"); for &dir in ["a", "b", "c"].iter() { println!("{}", cmd.clone().arg(dir)); } } ``` Output: ``` ls '-l' 'a' ls '-l' 'b' ls '-l' 'c' ``` Without the `clone()`, you'll end up with: ``` ls '-l' 'a' ls '-l' 'a' 'b' ls '-l' 'a' 'b' 'c' ``` cc #15294
- Loading branch information