Skip to content

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

@jyn514

Description

@jyn514

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)

Metadata

Metadata

Assignees

Labels

A-cli-helpArea: built-in command-line helpC-bugCategory: bug

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions