1#[[ 2## Overview 3]]# 4 5[Clippy][clippy] is a tool for catching common mistakes in Rust code and improving it. An 6expansive 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 15Simply add the following to the `.bazelrc` file in the root of your workspace: 16 17```text 18build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect 19build --output_groups=+clippy_checks 20``` 21 22This will enable clippy on all [Rust targets](./defs.md). 23 24Note that targets tagged with `no-clippy` will not perform clippy checks 25 26To use a local clippy.toml, add the following flag to your `.bazelrc`. Note that due to 27the 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 31build --@rules_rust//:clippy.toml=//:clippy.toml 32``` 33