Skip to content

Custom assert_*! macros for eq_op (and possibly others) #14903

@ojeda

Description

@ojeda

Description

In Linux, we use custom assert*! macros for KUnit tests. The eq_op lint only triggers for the standard ones, so e.g. the following doesn't lint:

fn f() {
    macro_rules! assert_eq {
        ($l:expr, $r:expr) => {}
    }

    assert_eq!(1 + 1, 2);
}

https://godbolt.org/z/W99Wsvs4r

Could a list of custom macros for assert*! ones be configured (similar to the lists for e.g. disallowed_macros) so that lints know they should apply to those too?

This is similar to #11303, in the sense that it is another case of linting not applying with custom versions of standard macros.

Not sure if this should be considered a false negative for eq_op or others, since it may be designed on purpose to only lint on the standard ones.

Version

rustc 1.87.0 (17067e9ac 2025-05-09)

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    G-Rust-for-LinuxIssues related to Rust-for-Linux wants and bugfixes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions