Skip to content

bool_assert_comparison: assert_eq! with a literal bool #8118

Closed
@cemoktra

Description

@cemoktra

Description

Hi,

i have a macro which generated a function for use in unit tests which is:

assert_eq!($MacroInput, my_struct.macro_input());

Clippy indicates in this case that i should use assert! but this would mean that i have to write an if/else block to handle both cases.
While this makes sense if i have a hardcoded boolean literal, but in this case i have macro generated boolean literals.

Version

rustc 1.57.0 (f1edd0429 2021-11-29)
binary: rustc
commit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c
commit-date: 2021-11-29
host: x86_64-unknown-linux-gnu
release: 1.57.0
LLVM version: 13.0.0

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveT-macrosType: Issues with macros and macro expansion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions