#lint #clippy #cargo-workspace #cmd #cargo

app cargo-lints

Utility for running lints specified from files

1 unstable release

0.1.0 May 11, 2021

#577 in Cargo plugins

Download history 100/week @ 2024-07-25 122/week @ 2024-08-01 121/week @ 2024-08-08 155/week @ 2024-08-15 203/week @ 2024-08-22 268/week @ 2024-08-29 317/week @ 2024-09-05 229/week @ 2024-09-12 258/week @ 2024-09-19 217/week @ 2024-09-26 204/week @ 2024-10-03 228/week @ 2024-10-10 273/week @ 2024-10-17 309/week @ 2024-10-24 280/week @ 2024-10-31 228/week @ 2024-11-07

1,138 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

~2.5–3.5MB
~57K SLoC