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. -
--libDocument the package’s library.
--test name…Document the specified integration test. This flag may be specified -multiple times and supports common Unix glob patterns.
---testsDocument 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.
---benchesDocument 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-targetsDocument all targets. This is equivalent to specifying --lib --bins --tests --benches --examples.