Skip to content

Commit 3b379fc

Browse files
authored
fix: Switch from --nocapture to --no-capture (#15930)
### What does this PR try to resolve? `--no-capture` was added in 1.88, with `--nocapture` being soft-deprecated. ### How to test and review this PR?
2 parents fa10d65 + 19f1d15 commit 3b379fc

File tree

13 files changed

+32
-32
lines changed

13 files changed

+32
-32
lines changed

src/cargo/ops/cargo_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,11 @@ fn report_test_error(
427427
crate::display_error(&err, &mut ws.gctx().shell());
428428

429429
let harness: bool = unit_err.unit.target.harness();
430-
let nocapture: bool = test_args.contains(&"--nocapture");
430+
let nocapture: bool = test_args.contains(&"--nocapture") || test_args.contains(&"--no-capture");
431431

432432
if !is_simple && executed && harness && !nocapture {
433433
drop(ws.gctx().shell().note(
434-
"test exited abnormally; to see the full output pass --nocapture to the harness.",
434+
"test exited abnormally; to see the full output pass --no-capture to the harness.",
435435
));
436436
}
437437
}

src/doc/man/cargo-bench.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ for more information on per-target settings.
126126

127127
By default the Rust test harness hides output from benchmark execution to keep
128128
results readable. Benchmark output can be recovered (e.g., for debugging) by
129-
passing `--nocapture` to the benchmark binaries:
129+
passing `--no-capture` to the benchmark binaries:
130130

131-
cargo bench -- --nocapture
131+
cargo bench -- --no-capture
132132

133133
{{#options}}
134134

src/doc/man/cargo-test.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ target options.
150150

151151
By default the Rust test harness hides output from test execution to keep
152152
results readable. Test output can be recovered (e.g., for debugging) by passing
153-
`--nocapture` to the test binaries:
153+
`--no-capture` to the test binaries:
154154

155-
cargo test -- --nocapture
155+
cargo test -- --no-capture
156156

157157
{{#options}}
158158

src/doc/man/generated_txt/cargo-bench.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ OPTIONS
283283
Display Options
284284
By default the Rust test harness hides output from benchmark execution
285285
to keep results readable. Benchmark output can be recovered (e.g., for
286-
debugging) by passing --nocapture to the benchmark binaries:
286+
debugging) by passing --no-capture to the benchmark binaries:
287287

288-
cargo bench -- --nocapture
288+
cargo bench -- --no-capture
289289

290290
-v, --verbose
291291
Use verbose output. May be specified twice for “very verbose”

src/doc/man/generated_txt/cargo-test.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ OPTIONS
309309
Display Options
310310
By default the Rust test harness hides output from test execution to
311311
keep results readable. Test output can be recovered (e.g., for
312-
debugging) by passing --nocapture to the test binaries:
312+
debugging) by passing --no-capture to the test binaries:
313313

314-
cargo test -- --nocapture
314+
cargo test -- --no-capture
315315

316316
-v, --verbose
317317
Use verbose output. May be specified twice for “very verbose”

src/doc/src/commands/cargo-bench.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,9 @@ Defaults to <code>target</code> in the root of the workspace.</dd>
310310

311311
By default the Rust test harness hides output from benchmark execution to keep
312312
results readable. Benchmark output can be recovered (e.g., for debugging) by
313-
passing `--nocapture` to the benchmark binaries:
313+
passing `--no-capture` to the benchmark binaries:
314314

315-
cargo bench -- --nocapture
315+
cargo bench -- --no-capture
316316

317317
<dl>
318318

src/doc/src/commands/cargo-test.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,9 @@ Defaults to <code>target</code> in the root of the workspace.</dd>
338338

339339
By default the Rust test harness hides output from test execution to keep
340340
results readable. Test output can be recovered (e.g., for debugging) by passing
341-
`--nocapture` to the test binaries:
341+
`--no-capture` to the test binaries:
342342

343-
cargo test -- --nocapture
343+
cargo test -- --no-capture
344344

345345
<dl>
346346

src/etc/cargo.bashcomp.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ _cargo()
9191
local opt__vendor="$opt_common $opt_mani $opt_lock $opt_sync --no-delete --respect-source-config --versioned-dirs"
9292
local opt__version="$opt_common $opt_lock"
9393
local opt__yank="$opt_common $opt_lock --version --undo --index --token --registry"
94-
local opt__libtest="--help --include-ignored --ignored --test --bench --list --logfile --nocapture --test-threads --skip -q --quiet --exact --color --format"
94+
local opt__libtest="--help --include-ignored --ignored --test --bench --list --logfile --no-capture --test-threads --skip -q --quiet --exact --color --format"
9595

9696
if [[ $cword -gt $dd_i ]]; then
9797
# Completion after -- separator.

src/etc/man/cargo-bench.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,11 @@ Defaults to \fBtarget\fR in the root of the workspace.
330330
.SS "Display Options"
331331
By default the Rust test harness hides output from benchmark execution to keep
332332
results readable. Benchmark output can be recovered (e.g., for debugging) by
333-
passing \fB\-\-nocapture\fR to the benchmark binaries:
333+
passing \fB\-\-no\-capture\fR to the benchmark binaries:
334334
.sp
335335
.RS 4
336336
.nf
337-
cargo bench \-\- \-\-nocapture
337+
cargo bench \-\- \-\-no\-capture
338338
.fi
339339
.RE
340340
.sp

src/etc/man/cargo-test.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,11 @@ Defaults to \fBtarget\fR in the root of the workspace.
357357
.SS "Display Options"
358358
By default the Rust test harness hides output from test execution to keep
359359
results readable. Test output can be recovered (e.g., for debugging) by passing
360-
\fB\-\-nocapture\fR to the test binaries:
360+
\fB\-\-no\-capture\fR to the test binaries:
361361
.sp
362362
.RS 4
363363
.nf
364-
cargo test \-\- \-\-nocapture
364+
cargo test \-\- \-\-no\-capture
365365
.fi
366366
.RE
367367
.sp

0 commit comments

Comments
 (0)