#lint #cargo-clippy #cmd #cli

app cargo-lints

Utility for running lints specified from files

1 unstable release

0.1.0 May 11, 2021

#1211 in Development tools

Download history 91/week @ 2023-11-20 115/week @ 2023-11-27 136/week @ 2023-12-04 89/week @ 2023-12-11 23/week @ 2023-12-18 5/week @ 2023-12-25 78/week @ 2024-01-01 146/week @ 2024-01-08 122/week @ 2024-01-15 141/week @ 2024-01-22 133/week @ 2024-01-29 185/week @ 2024-02-05 81/week @ 2024-02-12 93/week @ 2024-02-19 84/week @ 2024-02-26 136/week @ 2024-03-04

394 downloads per month

MIT license

8KB
136 lines

cargo-lints

cargo-lints is a utility for running lints specified from files.

Use Case

It is hard to share lint configuration in cargo workspace. Even more so as lint configuration in the form of:

$ cat src/lib.rs
#![warn(clippy::all)]
...

will not affect tests and benchmark binaries in ./benches/ and ./tests directories.

For now cargo and clippy don't provide convinient way to specify lints enabled for workspace and that is why it is handy to have a utility such as this one.

Installation

Install with:

$ cargo install --git https://github.com/soramitsu/iroha2-cargo_lints

Example

You should set some lints in lints.toml file:

$ cat lints.toml

#
# For all clippy lints please visit: https://rust-lang.github.io/rust-clippy/master/
#
deny = [
    'clippy::all',
    'clippy::cargo',
    'clippy::nursery',
    'clippy::pedantic',
]
allow = [
    'clippy::enum_glob_use',
]

After that you can run:

$ cargo lint fmt

to format the toml file.

$ cargo lint clippy

to run clippy (you don't have to have lints.toml file - in that case it will simply run cargo clippy).

Options

On the top level you can supply -f option:

$ cargo lints -f custom_lints.toml clippy

Also all options after cargo lints clippy are forwarded to clippy:

$ cargo lints clippy --tests --benches --all-features --all

Dependencies

~1.7–2.5MB
~45K SLoC