diff --git a/src/bin/cargo/commands/rustdoc.rs b/src/bin/cargo/commands/rustdoc.rs index d310d98580c..2d3a35dee06 100644 --- a/src/bin/cargo/commands/rustdoc.rs +++ b/src/bin/cargo/commands/rustdoc.rs @@ -19,17 +19,12 @@ pub fn cli() -> Command { .arg_message_format() .arg_silent_suggestion() .arg_package("Package to document") - .arg_targets_all( + .arg_targets_lib_bin_example( "Build only this package's library", "Build only the specified binary", "Build all binaries", "Build only the specified example", "Build all examples", - "Build only the specified test target", - "Build all targets that have `test = true` set", - "Build only the specified bench target", - "Build all targets that have `bench = true` set", - "Build all targets", ) .arg_features() .arg_parallel() diff --git a/src/doc/man/cargo-rustdoc.md b/src/doc/man/cargo-rustdoc.md index c2fb1beea10..b40d7f68d87 100644 --- a/src/doc/man/cargo-rustdoc.md +++ b/src/doc/man/cargo-rustdoc.md @@ -53,7 +53,19 @@ binary and library targets of the selected package. The binary will be skipped if its name is the same as the lib target. Binaries are skipped if they have `required-features` that are missing. -{{> options-targets }} +{{#options}} +{{> options-targets-lib-bin }} + +{{#option "`--example` _name_..." }} +{{actionverb}} the specified example. This flag may be specified multiple times +and supports common Unix glob patterns. +{{/option}} + +{{#option "`--examples`" }} +{{actionverb}} all example targets. +{{/option}} + +{{/options}} {{> section-features }} diff --git a/src/doc/man/generated_txt/cargo-rustdoc.txt b/src/doc/man/generated_txt/cargo-rustdoc.txt index ab78e282046..beb958d3749 100644 --- a/src/doc/man/generated_txt/cargo-rustdoc.txt +++ b/src/doc/man/generated_txt/cargo-rustdoc.txt @@ -51,13 +51,6 @@ OPTIONS be skipped if its name is the same as the lib target. Binaries are skipped if they have required-features that are missing. - Passing target selection flags will document only the specified targets. - - Note that --bin, --example, --test and --bench flags also support common - Unix glob patterns like *, ? and []. However, to avoid your shell - accidentally expanding glob patterns before Cargo handles them, you must - use single quotes or double quotes around each glob pattern. - --lib Document the package’s library. @@ -75,36 +68,6 @@ OPTIONS --examples Document all example targets. - --test name… - Document the specified integration test. This flag may be specified - multiple times and supports common Unix glob patterns. - - --tests - Document all targets that have the test = true manifest flag set. By - default this includes the library and binaries built as unittests, - and integration tests. Be aware that this will also build any - required dependencies, so the lib target may be built twice (once as - a unittest, and once as a dependency for binaries, integration - tests, etc.). Targets may be enabled or disabled by setting the test - flag in the manifest settings for the target. - - --bench name… - Document the specified benchmark. This flag may be specified - multiple times and supports common Unix glob patterns. - - --benches - Document all targets that have the bench = true manifest flag set. - By default this includes the library and binaries built as - benchmarks, and bench targets. Be aware that this will also build - any required dependencies, so the lib target may be built twice - (once as a benchmark, and once as a dependency for binaries, - benchmarks, etc.). Targets may be enabled or disabled by setting the - bench flag in the manifest settings for the target. - - --all-targets - Document all targets. This is equivalent to specifying --lib --bins - --tests --benches --examples. - Feature Selection The feature flags allow you to control which features are enabled. When no feature options are given, the default feature is activated for every diff --git a/src/doc/src/commands/cargo-rustdoc.md b/src/doc/src/commands/cargo-rustdoc.md index 4e73cd5f937..3b69969b22e 100644 --- a/src/doc/src/commands/cargo-rustdoc.md +++ b/src/doc/src/commands/cargo-rustdoc.md @@ -67,16 +67,7 @@ binary and library targets of the selected package. The binary will be skipped if its name is the same as the lib target. Binaries are skipped if they have `required-features` that are missing. -Passing target selection flags will document only the specified -targets. - -Note that `--bin`, `--example`, `--test` and `--bench` flags also -support common Unix glob patterns like `*`, `?` and `[]`. However, to avoid your -shell accidentally expanding glob patterns before Cargo handles them, you must -use single quotes or double quotes around each glob pattern. -
-
--lib

Document the package’s library.

@@ -104,45 +95,6 @@ and supports common Unix glob patterns.

-
--test name
-

Document the specified integration test. This flag may be specified -multiple times and supports common Unix glob patterns.

-
- - -
--tests
-

Document all targets that have the test = true manifest -flag set. By default this includes the library and binaries built as -unittests, and integration tests. Be aware that this will also build any -required dependencies, so the lib target may be built twice (once as a -unittest, and once as a dependency for binaries, integration tests, etc.). -Targets may be enabled or disabled by setting the test flag in the -manifest settings for the target.

-
- - -
--bench name
-

Document the specified benchmark. This flag may be specified multiple -times and supports common Unix glob patterns.

-
- - -
--benches
-

Document all targets that have the bench = true -manifest flag set. By default this includes the library and binaries built -as benchmarks, and bench targets. Be aware that this will also build any -required dependencies, so the lib target may be built twice (once as a -benchmark, and once as a dependency for binaries, benchmarks, etc.). -Targets may be enabled or disabled by setting the bench flag in the -manifest settings for the target.

-
- - -
--all-targets
-

Document all targets. This is equivalent to specifying --lib --bins --tests --benches --examples.

-
- -
### Feature Selection diff --git a/src/etc/man/cargo-rustdoc.1 b/src/etc/man/cargo-rustdoc.1 index c624de72c2f..5bd93253c51 100644 --- a/src/etc/man/cargo-rustdoc.1 +++ b/src/etc/man/cargo-rustdoc.1 @@ -52,14 +52,6 @@ binary and library targets of the selected package. The binary will be skipped if its name is the same as the lib target. Binaries are skipped if they have \fBrequired\-features\fR that are missing. .sp -Passing target selection flags will document only the specified -targets. -.sp -Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also -support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your -shell accidentally expanding glob patterns before Cargo handles them, you must -use single quotes or double quotes around each glob pattern. -.sp \fB\-\-lib\fR .RS 4 Document the package\[cq]s library. @@ -86,45 +78,6 @@ and supports common Unix glob patterns. .RS 4 Document all example targets. .RE -.sp -\fB\-\-test\fR \fIname\fR\[u2026] -.RS 4 -Document the specified integration test. This flag may be specified -multiple times and supports common Unix glob patterns. -.RE -.sp -\fB\-\-tests\fR -.RS 4 -Document all targets that have the \fBtest = true\fR manifest -flag set. By default this includes the library and binaries built as -unittests, and integration tests. Be aware that this will also build any -required dependencies, so the lib target may be built twice (once as a -unittest, and once as a dependency for binaries, integration tests, etc.). -Targets may be enabled or disabled by setting the \fBtest\fR flag in the -manifest settings for the target. -.RE -.sp -\fB\-\-bench\fR \fIname\fR\[u2026] -.RS 4 -Document the specified benchmark. This flag may be specified multiple -times and supports common Unix glob patterns. -.RE -.sp -\fB\-\-benches\fR -.RS 4 -Document all targets that have the \fBbench = true\fR -manifest flag set. By default this includes the library and binaries built -as benchmarks, and bench targets. Be aware that this will also build any -required dependencies, so the lib target may be built twice (once as a -benchmark, and once as a dependency for binaries, benchmarks, etc.). -Targets may be enabled or disabled by setting the \fBbench\fR flag in the -manifest settings for the target. -.RE -.sp -\fB\-\-all\-targets\fR -.RS 4 -Document all targets. This is equivalent to specifying \fB\-\-lib \-\-bins \-\-tests \-\-benches \-\-examples\fR\&. -.RE .SS "Feature Selection" The feature flags allow you to control which features are enabled. When no feature options are given, the \fBdefault\fR feature is activated for every diff --git a/tests/testsuite/cargo_rustdoc/help/stdout.term.svg b/tests/testsuite/cargo_rustdoc/help/stdout.term.svg index 750ed3c754c..e11ced8aaff 100644 --- a/tests/testsuite/cargo_rustdoc/help/stdout.term.svg +++ b/tests/testsuite/cargo_rustdoc/help/stdout.term.svg @@ -1,4 +1,4 @@ - +