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

Configuring clippy in Cargo.toml missing from documentation? #12164

Open
szabgab opened this issue Jan 18, 2024 · 3 comments
Open

Configuring clippy in Cargo.toml missing from documentation? #12164

szabgab opened this issue Jan 18, 2024 · 3 comments

Comments

@szabgab
Copy link

szabgab commented Jan 18, 2024

Description

I don't know where did I see that Clippy can be configured in Cargo.toml, but I don't seem to find it anywhere in the documentation. I also searched for the word priority and it was only mentioned in the prioritization of tasks not related to how the lints are prioritized.

Version

No response

Additional Labels

No response

@zoechi
Copy link

zoechi commented Jan 25, 2024

I just tried to get this lint configured

multiple_crate_versions = { level = "warn", allowed-duplicate-crates = [
  "async-lock",
] }

Which results in

warning: /home/myself/source/my_app/Cargo.toml: unused manifest key: workspace.lints.clippy.multiple_crate_versions.allowed-duplicate-crates
    Checking my_package_1 v0.1.0 (/home/myself/source/my_app/my_package_1)
    Checking my_package_2 v0.1.0 (/home/myself/source/my_app/my_package_2)

Here are examples of lints configured in Cargo.toml
https://rust-lang.github.io/rfcs/3389-manifest-lint.html#configurable-lints, but I also haven't found any examples in real projects.

@y21
Copy link
Member

y21 commented Jan 25, 2024

@zoechi Two things:

  • allowed-duplicate-crates is a lint configuration option, so you'll want to put allowed-duplicate-crates = [...] in clippy.toml
    • This specific part of the RFC (ability to configure lints using the [lints] table) is under "Future possibilities", so that's not possible yet (at least, to my knowledge)
  • allowed-duplicate-crates was very recently added (merged yesterday) and it's not on nightly clippy yet (I believe the next sync is today or tomorrow, so you need to wait a bit, unless you're building clippy from source and you already have the very latest changes)

@zoechi
Copy link

zoechi commented Jan 25, 2024

@y21 very helpful info !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants