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.
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_caseaccording to therustc-dev-guideas well asRFC #344.This PR renames:
implicit-features=>implicit_featiresrust-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_NAMEwould be theidentas well as thename: &'static strand then have a method onLintto make it lowercase as needed. This is whatrustcdoes, and it could work well here. It would ensure snake case asconstnames need to beSCREAMING_SNAKE_CASE, or a warning is shown.