diff options
| author | Roc Yu <rocyu@protonmail.com> | 2022-01-12 15:57:46 -0500 |
|---|---|---|
| committer | Roc Yu <rocyu@protonmail.com> | 2022-01-12 15:58:49 -0500 |
| commit | 48438ce1ae2a369f10287b94f8fa8074f91a9cab (patch) | |
| tree | 57b08bb451ac9eeda2833a98d34f1bf043b49b2e | |
| parent | 72e74d7b9cf1a7901650227e74650f1fcc797600 (diff) | |
| download | rust-48438ce1ae2a369f10287b94f8fa8074f91a9cab.tar.gz rust-48438ce1ae2a369f10287b94f8fa8074f91a9cab.zip | |
Remove intermediate `collect`
| -rw-r--r-- | src/librustdoc/doctest.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index ac24543929b..67d43fbf0bb 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -395,7 +395,7 @@ fn run_test( eprint!("{}", self.0); } } - let mut out_lines = str::from_utf8(&output.stderr) + let mut out = str::from_utf8(&output.stderr) .unwrap() .lines() .filter(|l| { @@ -406,15 +406,15 @@ fn run_test( true } }) - .collect::<Vec<_>>(); + .intersperse_with(|| "\n") + .collect::<String>(); // Add a \n to the end to properly terminate the last line, // but only if there was output to be printed - if !out_lines.is_empty() { - out_lines.push(""); + if !out.is_empty() { + out.push('\n'); } - let out = out_lines.join("\n"); let _bomb = Bomb(&out); match (output.status.success(), lang_string.compile_fail) { (true, true) => { |
