Skip to content

false positives in eq_op lint #229

@birkenfeld

Description

@birkenfeld

I just got this false positive when running clippy over racer:

src/racer/cargo.rs:314:12: 314:30 warning: equal expressions as operands to &&, #[warn(eq_op)] on by default
src/racer/cargo.rs:314         if f.pop() && f.pop() {
                                  ^~~~~~~~~~~~~~~~~~

I think the eq_op lint should be reduced a lot. Equal expressions at the AST level are not guaranteed to have the same result, and of course may have side effects too.

The lint should only look for simple expressions like consts (using const eval), variable lookups, field access and maybe casts to primitive types. Even operator application can have side effects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions