blob: abfc478796dbb5dbdb8495f33f7f6a30254e1dec [file] [log] [blame]
UebelAndre8fb68732021-05-04 06:48:20 -07001#[[
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).
UebelAndreed647162021-07-10 09:22:07 -070023
24Note that targets tagged with `noclippy` will not perform clippy checks
David Marcin404b84b2021-07-14 16:48:19 -070025
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```