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

fmt and clippy subcommands are not suggested when cargo is run without arguments #8680

Closed
jyn514 opened this issue Sep 6, 2020 · 2 comments · Fixed by #9848
Closed

fmt and clippy subcommands are not suggested when cargo is run without arguments #8680

jyn514 opened this issue Sep 6, 2020 · 2 comments · Fixed by #9848
Assignees
Labels
A-cli-help Area: built-in command-line help C-bug Category: bug

Comments

@jyn514
Copy link
Member

jyn514 commented Sep 6, 2020

Problem

Finding cargo fmt and cargo clippy is not very discoverable. The places it's mentioned are in the appendices to The Book (which I don't think many people read): https://doc.rust-lang.org/book/appendix-04-useful-development-tools.html#automatic-formatting-with-rustfmt and on playground under 'tools'. It would be great to also suggest them with 'common cargo commands'.

Steps

  1. cargo
Some common cargo commands are (see all commands with --list):
    build, b    Compile the current package
    check, c    Analyze the current package and report errors, but don't build object files
    clean       Remove the target directory
    doc         Build this package's and its dependencies' documentation
    new         Create a new cargo package
    init        Create a new cargo package in an existing directory
    run, r      Run a binary or example of the local package
    test, t     Run the tests
    bench       Run the benchmarks
    update      Update dependencies listed in Cargo.lock
    search      Search registry for crates
    publish     Package and upload this package to the registry
    install     Install a Rust binary. Default location is $HOME/.cargo/bin
    uninstall   Uninstall a Rust binary

Possible Solution(s)

Near doc, add

    fmt         Format every crate in this workspace
    clippy      Run a code linter to catch common bugs or Rust idioms

Notes

Output of cargo version: cargo 1.46.0 (149022b1d 2020-07-17)

@jyn514 jyn514 added the C-bug Category: bug label Sep 6, 2020
@jyn514
Copy link
Member Author

jyn514 commented Sep 6, 2020

These are shown with cargo --list, but without any description, which makes them look like third-party commands.

@nipunn1313
Copy link
Contributor

@rustbot claim

Read through some of the approaches already taken in #8729 and #8895. Going to try the slightly different approach of showing them with description in cargo --list. Implementation wise, they aren't builtins, but they're core enough in the cargo/rust ecosystem that giving them a description when installed seems reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli-help Area: built-in command-line help C-bug Category: bug
Projects
None yet
3 participants