diff options
| author | bors <bors@rust-lang.org> | 2022-03-25 04:01:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-03-25 04:01:00 +0000 |
| commit | 4ce257ff198d23bdf14e956fbf2fe0fed297201f (patch) | |
| tree | 17a7c3691b665cad9e92ba157ff8fa7a695d9515 /src | |
| parent | 661e8beec1fa5f3c58bf6e4362ae3c3fe0b4b1bd (diff) | |
| parent | 48438ce1ae2a369f10287b94f8fa8074f91a9cab (diff) | |
| download | rust-4ce257ff198d23bdf14e956fbf2fe0fed297201f.tar.gz rust-4ce257ff198d23bdf14e956fbf2fe0fed297201f.zip | |
Auto merge of #92361 - vacuus:doctest-run-test-out-lines, r=CraftSpider
Remove `collect` in `doctest::run_test`
Diffstat (limited to 'src')
| -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 8db5f8b0cff..41efda980a2 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -399,7 +399,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| { @@ -410,15 +410,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) => { |
