-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Summary
I was writing some code where I wanted to reassure readers that a particular numeric value corresponds to a particular ASCII character (e.g. 0x20 == b' '
).
I expressed this fact as a compiler-checked static assertion:
const _: () = assert!(0x20 == b' ');
Surprisingly, clippy flags this pattern not just as a warning, but as a hard error by default.
Lint Name
eq_op
Reproducer
I tried this code:
fn main() {
const _: () = assert!(0x20 == b' ');
}
I saw this happen:
error: equal expressions as operands to `==`
--> src/main.rs:2:27
|
2 | const _: () = assert!(0x20 == b' ');
| ^^^^^^^^^^^^
|
= 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
I expected to see this happen:
- No error or warning.
Version
rustc 1.89.0 (29483883e 2025-08-04)
binary: rustc
commit-hash: 29483883eed69d5fb4db01964cdf2af4d86e9cb2
commit-date: 2025-08-04
host: aarch64-apple-darwin
release: 1.89.0
LLVM version: 20.1.7
Additional Labels
No response
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have