rust-lang / rust-lang/rust-clippy
Use const_eval instead of constant for more lints?
Open
Nobody has claimed this yet.
C-question
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
- eq_op won't join here because we expressly only want syntactically equal expressions
- bit_mask uses it
- float_cmp uses it
- approx_const doesn't even need constant because we only want to match literals
- zero_div_zero might probably be able to use it
- min_max might use it (but we currently bail on refs, so it's debatable whether it should)
- loops could benefit from it
- identity_op shouldn't use it because it bails on refs and it's so low-payoff that a full const_eval isn't worth it
What do you folks think?
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
Review the listed lints—eq_op, approx_const, zero_div_zero, min_max, identity_op, and loops—and compare their current use of constant with const_eval. Resolve which checklist items should change and confirm the accepted scope in the issue discussion; done means the selected lints consistently use the agreed approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100