Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Update README/docs with clippy.toml limitations #9265

Closed
nyurik opened this issue Jul 30, 2022 · 3 comments · Fixed by #9557
Closed

[docs] Update README/docs with clippy.toml limitations #9265

nyurik opened this issue Jul 30, 2022 · 3 comments · Fixed by #9557
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@nyurik
Copy link
Contributor

nyurik commented Jul 30, 2022

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

@nyurik nyurik added the C-bug Category: Clippy is not doing the correct thing label Jul 30, 2022
@xFrednet
Copy link
Member

Hey 👋, 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.

@nyurik
Copy link
Contributor Author

nyurik commented Jul 30, 2022

Oh, thx @xFrednet , that's really confusing, I think we should update the readme (and wherever else the clippy.toml is mentiond)

@nyurik nyurik changed the title Unable to enable some pedantic lints using clippy.toml [docs] Update README/docs with clippy.toml limitations Jul 31, 2022
@nyurik
Copy link
Contributor Author

nyurik commented Jul 31, 2022

I updated this ticket to be a docs improvement ticket instead. Hopefully others won't get so confused :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants