rust-lang / rust-lang/rust-clippy
mistyped_literal_suffixes triggered for any integer that ends with _8 _16 _32 _64
Open
Nobody has claimed this yet.
C-bug
I-false-positive
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
Lint Name
mistyped_literal_suffixes
Reproducer
I tried this code:
fn main() {
0x0000_8;
0x0000_16;
0x0000_32;
0x0000_64;
1_8;
1_16;
1_32;
1_64;
}
I saw this happen:
error: mistyped literal suffix
[--> src/main.rs:2:5
](https://play.rust-lang.org/#) |
2 | 0x0000_8;
| ^^^^^^^^ help: did you mean to write: `0x0000_i8`
|
= note: `#[deny(clippy::mistyped_literal_suffixes)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
error: mistyped literal suffix
[--> src/main.rs:3:5
](https://play.rust-lang.org/#) |
3 | 0x0000_16;
| ^^^^^^^^^ help: did you mean to write: `0x0000_i16`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
error: mistyped literal suffix
[--> src/main.rs:4:5
](https://play.rust-lang.org/#) |
4 | 0x0000_32;
| ^^^^^^^^^ help: did you mean to write: `0x0000_i32`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
error: mistyped literal suffix
[--> src/main.rs:5:5
](https://play.rust-lang.org/#) |
5 | 0x0000_64;
| ^^^^^^^^^ help: did you mean to write: `0x0000_i64`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
error: mistyped literal suffix
[--> src/main.rs:6:5
](https://play.rust-lang.org/#) |
6 | 1_8;
| ^^^ help: did you mean to write: `1_i8`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
error: mistyped literal suffix
[--> src/main.rs:7:5
](https://play.rust-lang.org/#) |
7 | 1_16;
| ^^^^ help: did you mean to write: `1_i16`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
error: mistyped literal suffix
[--> src/main.rs:8:5
](https://play.rust-lang.org/#) |
8 | 1_32;
| ^^^^ help: did you mean to write: `1_i32`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
error: mistyped literal suffix
[--> src/main.rs:9:5
](https://play.rust-lang.org/#) |
9 | 1_64;
| ^^^^ help: did you mean to write: `1_i64`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
I expected to see this happen:
no denies
Version
No response
Additional Labels
No response
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 with the mistyped_literal_suffixes lint and the linked Rust Playground reproducer. Trace how integer literals ending in _8, _16, _32, and _64 are classified, then add regression coverage for the listed literals. Done means these valid literals no longer produce diagnostics while genuine mistyped suffixes remain checked.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100