const_is_empty emits for inline const assertions #13106
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Summary
The
const_is_empty
lint checks for expressions that always evaluate at compile-time tofalse
. While this lint makes sense for mostconst
items, I don't believe this lint should trigger for assertions inconst
blocks.Assertions in const blocks that unconditionally evaluate to
false
ortrue
are probably intentional, as these assertions allow users to perform compile-time invariant checking for unsafe code.Without this exception, we're emitting a lint for any generalized form of:
Lint Name
const_is_empty
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
assertions in const blocks should not trigger the lint.
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: