Skip to content

Commit 48438ce

Browse files
committed
Remove intermediate collect
1 parent 72e74d7 commit 48438ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustdoc/doctest.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ fn run_test(
395395
eprint!("{}", self.0);
396396
}
397397
}
398-
let mut out_lines = str::from_utf8(&output.stderr)
398+
let mut out = str::from_utf8(&output.stderr)
399399
.unwrap()
400400
.lines()
401401
.filter(|l| {
@@ -406,15 +406,15 @@ fn run_test(
406406
true
407407
}
408408
})
409-
.collect::<Vec<_>>();
409+
.intersperse_with(|| "\n")
410+
.collect::<String>();
410411

411412
// Add a \n to the end to properly terminate the last line,
412413
// but only if there was output to be printed
413-
if !out_lines.is_empty() {
414-
out_lines.push("");
414+
if !out.is_empty() {
415+
out.push('\n');
415416
}
416417

417-
let out = out_lines.join("\n");
418418
let _bomb = Bomb(&out);
419419
match (output.status.success(), lang_string.compile_fail) {
420420
(true, true) => {

0 commit comments

Comments
 (0)