Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(help): Generalize --ignore-rust-version #13741

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/bin/cargo/commands/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,10 @@ While you can use the crate in your implementation, it cannot be referenced in y
Example uses:
- Depending on multiple versions of a crate
- Depend on crates with the same name from different registries"),
flag(
"ignore-rust-version",
"Ignore `rust-version` specification in packages"
),
])
.arg_manifest_path_without_unsupported_path_tip()
.arg_package("Package to modify")
.arg_ignore_rust_version()
.arg_dry_run("Don't actually write the manifest")
.arg_silent_suggestion()
.next_help_heading("Source")
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub fn cli() -> Command {
"no-fail-fast",
"Run all benchmarks regardless of failure",
))
.arg_ignore_rust_version()
.arg_message_format()
.arg_silent_suggestion()
.arg_package_spec(
Expand Down Expand Up @@ -51,6 +50,7 @@ pub fn cli() -> Command {
.arg_unit_graph()
.arg_timings()
.arg_manifest_path()
.arg_ignore_rust_version()
.after_help(color_print::cstr!(
"Run `<cyan,bold>cargo help bench</>` for more detailed information.\n"
))
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub fn cli() -> Command {
// subcommand aliases are handled in aliased_command()
// .alias("b")
.about("Compile a local package and all of its dependencies")
.arg_ignore_rust_version()
.arg_future_incompat_report()
.arg_message_format()
.arg_silent_suggestion()
Expand Down Expand Up @@ -40,6 +39,7 @@ pub fn cli() -> Command {
.arg_unit_graph()
.arg_timings()
.arg_manifest_path()
.arg_ignore_rust_version()
.after_help(color_print::cstr!(
"Run `<cyan,bold>cargo help build</>` for more detailed information.\n"
))
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub fn cli() -> Command {
// subcommand aliases are handled in aliased_command()
// .alias("c")
.about("Check a local package and all of its dependencies for errors")
.arg_ignore_rust_version()
.arg_future_incompat_report()
.arg_message_format()
.arg_silent_suggestion()
Expand Down Expand Up @@ -37,6 +36,7 @@ pub fn cli() -> Command {
.arg_unit_graph()
.arg_timings()
.arg_manifest_path()
.arg_ignore_rust_version()
.after_help(color_print::cstr!(
"Run `<cyan,bold>cargo help check</>` for more detailed information.\n"
))
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub fn cli() -> Command {
"Don't build documentation for dependencies",
))
.arg(flag("document-private-items", "Document private items"))
.arg_ignore_rust_version()
.arg_message_format()
.arg_silent_suggestion()
.arg_package_spec(
Expand All @@ -40,6 +39,7 @@ pub fn cli() -> Command {
.arg_unit_graph()
.arg_timings()
.arg_manifest_path()
.arg_ignore_rust_version()
.after_help(color_print::cstr!(
"Run `<cyan,bold>cargo help doc</>` for more detailed information.\n"
))
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub fn cli() -> Command {
"allow-staged",
"Fix code even if the working directory has staged changes",
))
.arg_ignore_rust_version()
.arg_message_format()
.arg_silent_suggestion()
.arg_package_spec(
Expand Down Expand Up @@ -54,6 +53,7 @@ pub fn cli() -> Command {
.arg_target_dir()
.arg_timings()
.arg_manifest_path()
.arg_ignore_rust_version()
.after_help(color_print::cstr!(
"Run `<cyan,bold>cargo help fix</>` for more detailed information.\n"
))
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pub fn cli() -> Command {
.num_args(0..)
.trailing_var_arg(true),
)
.arg_ignore_rust_version()
.arg_message_format()
.arg_silent_suggestion()
.arg_package("Package with the target to run")
Expand All @@ -39,6 +38,7 @@ pub fn cli() -> Command {
.arg_target_triple("Build for the target triple")
.arg_target_dir()
.arg_manifest_path()
.arg_ignore_rust_version()
.arg_unit_graph()
.arg_timings()
.after_help(color_print::cstr!(
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ pub fn cli() -> Command {
"Comma separated list of types of crates for the compiler to emit",
))
.arg_future_incompat_report()
.arg_ignore_rust_version()
.arg_message_format()
.arg_silent_suggestion()
.arg_package("Package to build")
Expand All @@ -53,6 +52,7 @@ pub fn cli() -> Command {
.arg_unit_graph()
.arg_timings()
.arg_manifest_path()
.arg_ignore_rust_version()
.after_help(color_print::cstr!(
"Run `<cyan,bold>cargo help rustc</>` for more detailed information.\n"
))
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub fn cli() -> Command {
"open",
"Opens the docs in a browser after the operation",
))
.arg_ignore_rust_version()
.arg_message_format()
.arg_silent_suggestion()
.arg_package("Package to document")
Expand Down Expand Up @@ -46,6 +45,7 @@ pub fn cli() -> Command {
.arg_unit_graph()
.arg_timings()
.arg_manifest_path()
.arg_ignore_rust_version()
.after_help(color_print::cstr!(
"Run `<cyan,bold>cargo help rustdoc</>` for more detailed information.\n"
))
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub fn cli() -> Command {
.arg(flag("doc", "Test only this library's documentation"))
.arg(flag("no-run", "Compile, but don't run tests"))
.arg(flag("no-fail-fast", "Run all tests regardless of failure"))
.arg_ignore_rust_version()
.arg_future_incompat_report()
.arg_message_format()
.arg(
Expand Down Expand Up @@ -58,6 +57,7 @@ pub fn cli() -> Command {
.arg_unit_graph()
.arg_timings()
.arg_manifest_path()
.arg_ignore_rust_version()
.after_help(color_print::cstr!(
"Run `<cyan,bold>cargo help test</>` for more detailed information.\n\
Run `<cyan,bold>cargo test -- --help</>` for test binary options.\n",
Expand Down
11 changes: 7 additions & 4 deletions src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,13 @@ pub trait CommandExt: Sized {
}

fn arg_ignore_rust_version(self) -> Self {
self._arg(flag(
"ignore-rust-version",
"Ignore `rust-version` specification in packages",
))
self._arg(
flag(
"ignore-rust-version",
"Ignore `rust-version` specification in packages",
)
.help_heading(heading::MANIFEST_OPTIONS),
)
}

fn arg_future_incompat_report(self) -> Self {
Expand Down
6 changes: 2 additions & 4 deletions src/doc/man/cargo-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ crates, the features for a specific crate may be enabled with
which enables all specified features.
{{/option}}

{{#option "`--ignore-rust-version`" }}
Ignore `rust-version` specification in packages.
{{/option}}

{{/options}}


Expand All @@ -161,6 +157,8 @@ Ignore `rust-version` specification in packages.
Add dependencies to only the specified package.
{{/option}}

{{> options-ignore-rust-version }}

{{> options-locked }}
{{/options}}

Expand Down
4 changes: 2 additions & 2 deletions src/doc/man/cargo-bench.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ for more information on per-target settings.

{{> options-profile }}

{{> options-ignore-rust-version }}

{{> options-timings }}

{{/options}}
Expand Down Expand Up @@ -145,6 +143,8 @@ passing `--nocapture` to the benchmark binaries:
{{#options}}
{{> options-manifest-path }}

{{> options-ignore-rust-version }}

{{> options-locked }}
{{/options}}

Expand Down
4 changes: 2 additions & 2 deletions src/doc/man/cargo-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ they have `required-features` that are missing.

{{> options-profile }}

{{> options-ignore-rust-version }}

{{> options-timings }}

{{/options}}
Expand Down Expand Up @@ -86,6 +84,8 @@ See <https://github.com/rust-lang/cargo/issues/5579> for more information.
{{#options}}
{{> options-manifest-path }}

{{> options-ignore-rust-version }}

{{> options-locked }}
{{/options}}

Expand Down
4 changes: 2 additions & 2 deletions src/doc/man/cargo-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ they have `required-features` that are missing.

{{> options-profile-legacy-check }}

{{> options-ignore-rust-version }}

{{> options-timings }}

{{/options}}
Expand All @@ -69,6 +67,8 @@ they have `required-features` that are missing.
{{#options}}
{{> options-manifest-path }}

{{> options-ignore-rust-version }}

{{> options-locked }}
{{/options}}

Expand Down
4 changes: 2 additions & 2 deletions src/doc/man/cargo-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ and supports common Unix glob patterns.

{{> options-profile }}

{{> options-ignore-rust-version }}

{{> options-timings }}

{{/options}}
Expand All @@ -103,6 +101,8 @@ and supports common Unix glob patterns.
{{#options}}
{{> options-manifest-path }}

{{> options-ignore-rust-version }}

{{> options-locked }}
{{/options}}

Expand Down
4 changes: 2 additions & 2 deletions src/doc/man/cargo-fix.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ When no target selection options are given, `cargo fix` will fix all targets

{{> options-profile-legacy-check }}

{{> options-ignore-rust-version }}

{{> options-timings }}

{{/options}}
Expand All @@ -149,6 +147,8 @@ When no target selection options are given, `cargo fix` will fix all targets
{{#options}}
{{> options-manifest-path }}

{{> options-ignore-rust-version }}

{{> options-locked }}
{{/options}}

Expand Down
4 changes: 2 additions & 2 deletions src/doc/man/cargo-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ See also the `--profile` option for choosing a specific profile by name.

{{> options-profile }}

{{> options-ignore-rust-version }}

{{> options-timings }}

{{/options}}

### Manifest Options

{{#options}}
{{> options-ignore-rust-version }}

{{> options-locked }}
{{/options}}

Expand Down
4 changes: 2 additions & 2 deletions src/doc/man/cargo-run.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ Run the specified example.

{{> options-profile }}

{{> options-ignore-rust-version }}

{{> options-timings }}

{{/options}}
Expand All @@ -85,6 +83,8 @@ Run the specified example.

{{> options-manifest-path }}

{{> options-ignore-rust-version }}

{{> options-locked }}

{{/options}}
Expand Down
4 changes: 2 additions & 2 deletions src/doc/man/cargo-rustc.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ The `rustc` subcommand will treat the following named profiles with special beha
See [the reference](../reference/profiles.html) for more details on profiles.
{{/option}}

{{> options-ignore-rust-version }}

{{> options-timings }}

{{#option "`--crate-type` _crate-type_"}}
Expand Down Expand Up @@ -110,6 +108,8 @@ This flag only works when building a `lib` or `example` library target.

{{> options-manifest-path }}

{{> options-ignore-rust-version }}

{{> options-locked }}

{{/options}}
Expand Down
4 changes: 2 additions & 2 deletions src/doc/man/cargo-rustdoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ if its name is the same as the lib target. Binaries are skipped if they have

{{> options-profile }}

{{> options-ignore-rust-version }}

{{> options-timings }}

{{/options}}
Expand All @@ -92,6 +90,8 @@ if its name is the same as the lib target. Binaries are skipped if they have
{{#options}}
{{> options-manifest-path }}

{{> options-ignore-rust-version }}

{{> options-locked }}
{{/options}}

Expand Down
4 changes: 2 additions & 2 deletions src/doc/man/cargo-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ target options.

{{> options-profile }}

{{> options-ignore-rust-version }}

{{> options-timings }}

{{/options}}
Expand Down Expand Up @@ -170,6 +168,8 @@ results readable. Test output can be recovered (e.g., for debugging) by passing

{{> options-manifest-path }}

{{> options-ignore-rust-version }}

{{> options-locked }}

{{/options}}
Expand Down
6 changes: 3 additions & 3 deletions src/doc/man/generated_txt/cargo-add.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ OPTIONS
be enabled with package-name/feature-name syntax. This flag may be
specified multiple times, which enables all specified features.

--ignore-rust-version
Ignore rust-version specification in packages.

Display Options
-v, --verbose
Use verbose output. May be specified twice for “very verbose”
Expand Down Expand Up @@ -165,6 +162,9 @@ OPTIONS
-p spec, --package spec
Add dependencies to only the specified package.

--ignore-rust-version
Ignore rust-version specification in packages.

--locked
Asserts that the exact same dependencies and versions are used as
when the existing Cargo.lock file was originally generated. Cargo
Expand Down
Loading