rust-lang / rust-lang/rust-clippy
New lint: preferred case for hex digit literals
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
What it does
Warns if {upper,lower}case hex digits are used in a literal (i.e. forces a particular case). That is, it is stronger than the mixed_case_hex_literals lint.
This is a "preference lint pair", like the {un,}separated_literal_suffix and inline_asm_x86_{att,intel}_syntax ones.
Categories (optional)
- Kind: style.
Drawbacks
In general, it is arguable whether this sort of "formatting-like" lints like {un,}separated_literal_suffix or the current one should be in Clippy vs. rustfmt (e.g. rustfmt already has a hex_literal_case option).
One advantage of having them as lints is that projects may allow them locally in certain cases.
Example
0xabc
Could be written as:
0xABC
or viceversa.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining the existing mixed_case_hex_literals lint and the preference-lint pairs named in the issue to understand their implementation and tests. Add the new lint so it consistently warns about the non-preferred case of hexadecimal digits, with coverage for the example and its alternative spelling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100