Before this PR we would pass ChildOutput not by reference and then had to clone it in a few places. For example in the tuple implementations. Consider this example:
let (StdoutUntrimmed(a), Stderr(b), Status(c)) = run!("...");
Here we would clone ChildOutput (including the complete captured stdout and stderr) 3 times, for every tuple component.
This PR changes that to only clone stdout once when StdoutUntrimmed is created and stderr once when Stderr is created.
This is not strictly better though. In this example we would not have to clone before, but now we do:
let StdoutUntrimmed(a) = run!("...");
I still think that this is probably a good change.
Before this PR we would pass
ChildOutput
not by reference and then had to clone it in a few places. For example in the tuple implementations. Consider this example:Here we would clone
ChildOutput
(including the complete capturedstdout
andstderr
) 3 times, for every tuple component.This PR changes that to only clone
stdout
once whenStdoutUntrimmed
is created andstderr
once whenStderr
is created.This is not strictly better though. In this example we would not have to clone before, but now we do:
I still think that this is probably a good change.