rust-clippy
rust-clippy copied to clipboard
[docs] Update README/docs with clippy.toml limitations
UPDATE Turns out this is not a bug but missing feature and unclear documentation, so converting to a docs improvement ticket.
Please clarify what lints/features are available in clippy.toml
, and that most regular lints cannot be enabled/disabled in it. Relevant docs locations (might be more?):
Original post
Summary
I was unable to configure clippy.toml
to include some pedantic lints as described in the main readme. It seems clippy.toml only supports a subset of the all available clippy lints.
Reproducer
I created a clippy.toml
in the root of the crate with this content (I also tried it with -
instead of the _
to make sure)
default_trait_access = true
I expected to see this happen:
cargo clippy
should have produced some lint suggestions.
Instead, this happened:
> cargo clean && cargo clippy
error: error reading Clippy's configuration file `...clippy.toml`: unknown field `default_trait_access`, expected one of
allow-dbg-in-tests cargo-ignore-publish enum-variant-name-threshold msrv trivial-copy-size-limit
allow-expect-in-tests cognitive-complexity-threshold enum-variant-size-threshold pass-by-value-size-limit type-complexity-threshold
allow-unwrap-in-tests cyclomatic-complexity-threshold literal-representation-threshold single-char-binding-names-threshold unreadable-literal-lint-fractions
allowed-scripts disallowed-methods max-fn-params-bools standard-macro-braces upper-case-acronyms-aggressive
array-size-threshold disallowed-types max-include-file-size third-party vec-box-size-threshold
avoid-breaking-exported-api doc-valid-idents max-struct-bools too-large-for-stack verbose-bit-mask-threshold
await-holding-invalid-types enable-raw-pointer-heuristic-for-send max-suggested-slice-pattern-length too-many-arguments-threshold warn-on-all-wildcard-imports
blacklisted-names enforced-import-renames max-trait-bounds too-many-lines-threshold
at line 1 column 1
Version
rustc 1.64.0-nightly (9067d5277 2022-07-28)
binary: rustc
commit-hash: 9067d5277d10f0f32a49ec9c125a33828e26a32b
commit-date: 2022-07-28
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6
Additional Labels
No response
Hey :wave:, the config file is only for config values and not lints themselves. There is an issue #6625 for having a config file which allows the configuration of lint levels.
Oh, thx @xFrednet , that's really confusing, I think we should update the readme (and wherever else the clippy.toml is mentiond)
I updated this ticket to be a docs improvement ticket instead. Hopefully others won't get so confused :)