rust-lang / rust-lang/rust-clippy
Behavioral regression in eq_op
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
Lint: https://rust-lang.github.io/rust-clippy/master/index.html#/eq_op
It appears that now checks occur after evaluation of environment variables
Version known to work correctly:
❯ cargo clippy --version
clippy 0.1.70 (90c54180 2023-05-31)
Output:
error: equal expressions as operands to `==`
--> src/app.rs:104:5
|
104 | env!("PYAPP_DISTRIBUTION_PIP_AVAILABLE") == "1"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op
= note: `#[deny(clippy::eq_op)]` on by default
error: equal expressions as operands to `==`
--> src/commands/self_cmd/metadata.rs:10:18
|
10 | #[command(hide = env!("PYAPP_EXPOSE_METADATA") == "0")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op
error: equal expressions as operands to `==`
--> src/commands/self_cmd/pip.rs:8:18
|
8 | #[command(hide = env!("PYAPP_EXPOSE_PIP") == "0", disable_help_flag = true)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op
error: equal expressions as operands to `==`
--> src/commands/self_cmd/python.rs:8:18
|
8 | #[command(hide = env!("PYAPP_EXPOSE_PYTHON") == "0", disable_help_flag = true)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op
error: equal expressions as operands to `==`
--> src/commands/self_cmd/python_path.rs:8:18
|
8 | #[command(hide = env!("PYAPP_EXPOSE_PYTHON_PATH") == "0")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op
Reproducer
Version
rustc 1.73.0 (cc66ad468 2023-10-03)
binary: rustc
commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33
commit-date: 2023-10-03
host: x86_64-unknown-linux-gnu
release: 1.73.0
LLVM version: 17.0.2
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 eq_op lint documentation and reproduce the report using the linked Rust Playground example on the stated Rust 1.73.0 version. Compare the behavior with the working Clippy version and the listed env! expressions in src/app.rs and the src/commands/self_cmd files; done means the regression is understood and the lint no longer reports these valid comparisons incorrectly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100