Skip to content
Open
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
24 changes: 15 additions & 9 deletions src/bin/cargo/cli.rs

@epage epage Jul 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: apply rustfmt to print_zhelp

While we prefer small commits, what is more important is for the commits to be atomic, reflecting how the code should be reviewed and merged and not how it was developed.

If you decide to go for multiple commits, that could look like

  • a commit for just adding "cargo"
  • a commit for each re-arrangement of text, if needed
  • a commit for changing direct text to annotate snippets
  • any new parts of annotate snippets added

View changes since the review

Original file line number Diff line number Diff line change
Expand Up @@ -125,26 +125,32 @@ fn print_zhelp(gctx: &GlobalContext) {
drop_println!(
gctx,
"\
{header}Available unstable (nightly-only) flags:{header:#}
{header}Available unstable (nightly-only) cargo flags:{header:#}

{z_flags}

Run with `{literal}cargo -Z{literal:#} {placeholder}[FLAG] [COMMAND]{placeholder:#}`",
);
if !gctx.nightly_features_allowed {
drop_println!(
gctx,
"\nUnstable flags are only available on the nightly channel \
of Cargo, but this is the `{}` channel.\n\
{}",
features::channel(),
features::SEE_CHANNELS
let _ = gctx.shell().print_report(
&[Level::WARNING
.secondary_title(format!(
"unstable flags are unavailable on the current (`{}`) channel",
features::channel()
))
.element(Level::HELP.message("run on the nightly channel to use them"))
.element(Level::HELP.message(format!(
"see {} for more information about Rust release channels",
features::SEE_CHANNELS
)))],
false,
);
}
drop_println!(
gctx,
"\nSee https://doc.rust-lang.org/nightly/cargo/reference/unstable.html \

@epage epage Jul 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least at #17145 (comment), I was suggesting moving the "See" above the use of annotate-snippets. Is there a reason it was kept here?

View changes since the review

for more information about these flags."
for more information about these flags.\n\n\
note: to see rustc unstable features, run `rustc -Zhelp`"

@epage epage Jul 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect this note to either be moved to gctx.shell().note or annotate snippets

View changes since the review

);
}

Expand Down
8 changes: 6 additions & 2 deletions tests/testsuite/cargo/z_help/stdout.term.svg
Comment thread
epage marked this conversation as resolved.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.