rust-lang / rust-lang/rust-clippy

Make unreadable_literal useful even when we use numbers with two decimals

Open
#13,663 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lint
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

What it does

In a project there are a lot of numbers like this: 12345678900 which means 123456789.00, maybe because we are using rust_decimal::Decimal::new(12345678900, 2).

unreadable_literal makes me write instead: 12_345_678_900 which as you can see is misleading during the code review.

Why not also suggest 1_23_45_67_89_00, maybe changing the settings?

Advantage

No response

Drawbacks

No response

Example
<code>

Could be written as:

<code>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the unreadable_literal lint implementation and reviewing how its current grouping behavior is checked. Clarify the desired configurable grouping for values with two decimal places, then add coverage showing the intended suggestions and confirming existing cases remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.