rust-lang / rust-lang/rust-clippy

Use const_eval instead of constant for more lints?

Open
#461 3 comments 0 reactions 0 assignees View on GitHub

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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.