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

doc-valid-idents not respected in Cargo.toml [lints] table #11751

Closed
rockboynton opened this issue Nov 2, 2023 · 4 comments
Closed

doc-valid-idents not respected in Cargo.toml [lints] table #11751

rockboynton opened this issue Nov 2, 2023 · 4 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@rockboynton
Copy link

Summary

See title

Reproducer

I tried this code:

[lints.clippy]
pedantic    = "deny"
doc_markdown = { level = "deny", doc_valid_idents = ["GHz", ".."] }
//! GHz

I expected to see this happen:

A clean build

Instead, this happened:

I still see the error on the GHz in my doc comment

Version

❯ rustc -Vv
rustc 1.74.0-nightly (58eefc33a 2023-08-24)
binary: rustc
commit-hash: 58eefc33adf769a1abe12ad94b3e6811185b4ce5
commit-date: 2023-08-24
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0

Additional Labels

No response

@rockboynton rockboynton added the C-bug Category: Clippy is not doing the correct thing label Nov 2, 2023
@bayareaunicorn
Copy link

Lints in Rust can be controlled and customized using the #[allow(lint_name)] attribute in the code. This attribute allows you to selectively disable specific lints for specific sections of code. While this attribute is typically used within the code itself, it may be worth exploring if it can be applied to the Cargo.toml file as well.

@rockboynton
Copy link
Author

Hi @Stoned33, thanks for your reply. While that does work per crate, other lints work with overriding them in the Cargo.toml as in my example, although I do notice it only seems to work when it's only the bare level key.

For example, this works as expected, to allow denying the pedantic group with an exception, since the order matters in the file

[lints.clippy]
pedantic    = "deny"
borrow_as_ptr = "allow" 

@samueltardieu
Copy link
Contributor

Isn't lint extra configuration supposed to be given in clippy.toml? If you create one with

doc-valid-idents = ["GHz", ".."]

it should do what you want.

@Alexendoo
Copy link
Member

Opened a cargo issue for this: rust-lang/cargo#12917

bors added a commit that referenced this issue Jan 31, 2024
Add `lint_groups_priority` lint

Warns when a lint group in Cargo.toml's `[lints]` section shares the same priority as a lint. This is in the cargo section but is categorised as `correctness` so it's on by default, it doesn't call `cargo metadata` though and parses the `Cargo.toml` directly

The lint should be temporary until rust-lang/cargo#12918 is resolved, but in the meanwhile this is an common issue to run into

- #11237
- #11751
- #11830

changelog: Add [`lint_groups_priority`] lint

r? `@flip1995`
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

No branches or pull requests

4 participants