1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-08-15 11:55:49 +02:00
tldr/pages/common/cargo-clippy.md
Managor d0a4ac3bc4
cargo*: add option placeholders and fix some syntax (#17270)
Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
2025-07-20 15:41:22 +00:00

36 lines
912 B
Markdown

# cargo clippy
> A collection of lints to catch common mistakes and improve your Rust code.
> More information: <https://github.com/rust-lang/rust-clippy>.
- Run checks over the code in the current directory:
`cargo clippy`
- Require that `Cargo.lock` is up to date:
`cargo clippy --locked`
- Run checks on all packages in the workspace:
`cargo clippy --workspace`
- Run checks for a package:
`cargo clippy --package {{package}}`
- Run checks for a lint group (see <https://rust-lang.github.io/rust-clippy/stable/index.html#?groups=cargo,complexity,correctness,deprecated,nursery,pedantic,perf,restriction,style,suspicious>):
`cargo clippy -- {{[-W|--warn]}} clippy::{{lint_group}}`
- Treat warnings as errors:
`cargo clippy -- {{[-D|--deny]}} warnings`
- Run checks and ignore warnings:
`cargo clippy -- {{[-A|--allow]}} warnings`
- Apply Clippy suggestions automatically:
`cargo clippy --fix`