clippy.rst (1120B)
1 clippy 2 ====== 3 4 `clippy`_ is the tool for Rust static analysis. 5 6 Run Locally 7 ----------- 8 9 The mozlint integration of clippy can be run using mach: 10 11 .. parsed-literal:: 12 13 $ mach lint --linter clippy <file paths> 14 15 # Return warnings 16 17 $ mach lint --warnings --linter clippy <file paths> 18 19 .. note:: 20 21 clippy expects a path or a .rs file. It doesn't accept Cargo.toml 22 as it would break the mozlint workflow. 23 24 To use Rust nightly, you can set the environment variable `RUSTUP_TOOLCHAIN` to `nightly`: 25 26 .. parsed-literal: 27 28 # Note that you need to have nightly installed with Rustup 29 # A clobber might be necessary after switching toolchains 30 $ RUSTUP_TOOLCHAIN=nightly ./mach lint --warning -l clippy . 31 32 Configuration 33 ------------- 34 35 To enable clippy on new directory, add the path to the include 36 section in the `clippy.yml <https://searchfox.org/mozilla-central/source/tools/lint/clippy.yml>`_ file. 37 38 39 Sources 40 ------- 41 42 * `Configuration (YAML) <https://searchfox.org/mozilla-central/source/tools/lint/clippy.yml>`_ 43 * `Source <https://searchfox.org/mozilla-central/source/tools/lint/clippy/__init__.py>`_