-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix: Make lint names snake_case #13635
Conversation
r? @weihanglo rustbot has assigned @weihanglo. Use |
This is strange because every lint and group in |
222826f
to
0a400d5
Compare
I did some more digging and found that:
So I made it so we use |
let normalized_lints = cargo_lints | ||
.into_iter() | ||
.map(|(name, lint)| (name.replace('-', "_"), lint)) | ||
.collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking: this could live in toml/mod.rs
when we resolve the manifest.
Please don't do that right now as I have probably 20 commits locally changing that code :)
@bors r+ |
☀️ Test successful - checks-actions |
…rkingjubilee Update cargo 5 commits in a510712d05c6c98f987af24dd73cdfafee8922e6..499a61ce7a0fc6a72040084862a68b2603e770e8 2024-03-25 03:45:54 +0000 to 2024-03-26 04:17:04 +0000 - fix: do not borrow shell across registry query (rust-lang/cargo#13647) - Do not strip debuginfo by default for MSVC (rust-lang/cargo#13630) - chore(deps): update msrv (rust-lang/cargo#13577) - Fix doc collision for lib/bin with a dash in the inferred name. (rust-lang/cargo#13640) - refactor: Make lint names snake_case (rust-lang/cargo#13635) r? ghost
When working on #13621, I somehow missed that lint names should be
snake_case
according to therustc-dev-guide
as well asRFC #344
.This PR renames:
implicit-features
=>implicit_featires
rust-2024-compatibility
=>rust_2024_compatibility
.Note: We should probably have some tooling to enforce this, but I was unsure if it belonged to this PR or another one. One solution would be to use a macro to create the
const LINT_NAME: Lint = {...}
, whereLINT_NAME
would be theident
as well as thename: &'static str
and then have a method onLint
to make it lowercase as needed. This is whatrustc
does, and it could work well here. It would ensure snake case asconst
names need to beSCREAMING_SNAKE_CASE
, or a warning is shown.