UebelAndre | 8fb6873 | 2021-05-04 06:48:20 -0700 | [diff] [blame] | 1 | #[[ |
| 2 | ## Overview |
| 3 | ]]# |
| 4 | |
| 5 | [Clippy][clippy] is a tool for catching common mistakes in Rust code and improving it. An |
| 6 | expansive list of lints and the justification can be found in their [documentation][docs]. |
| 7 | |
| 8 | [clippy]: https://github.com/rust-lang/rust-clippy#readme |
| 9 | [docs]: https://rust-lang.github.io/rust-clippy/ |
| 10 | |
| 11 | #[[ |
| 12 | ### Setup |
| 13 | ]]# |
| 14 | |
| 15 | Simply add the following to the `.bazelrc` file in the root of your workspace: |
| 16 | |
| 17 | ```text |
| 18 | build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect |
| 19 | build --output_groups=+clippy_checks |
| 20 | ``` |
| 21 | |
| 22 | This will enable clippy on all [Rust targets](./defs.md). |
UebelAndre | ed64716 | 2021-07-10 09:22:07 -0700 | [diff] [blame] | 23 | |
| 24 | Note that targets tagged with `noclippy` will not perform clippy checks |
David Marcin | 404b84b | 2021-07-14 16:48:19 -0700 | [diff] [blame] | 25 | |
| 26 | To use a local clippy.toml, add the following flag to your `.bazelrc`. Note that due to |
| 27 | the upstream implementation of clippy, this file must be named either `.clippy.toml` or |
| 28 | `clippy.toml`. Using a custom config file requires Rust 1.34.0 or newer. |
| 29 | |
| 30 | ```text |
| 31 | build --@rules_rust//:clippy.toml=//:clippy.toml |
| 32 | ``` |