Skip to content

Add support for binary function calls in suspicious_operation_groupings lint #6474

Open
@MarijnS95

Description

@MarijnS95

#6086 introduced suspicious_operation_groupings that made us find a binop issue in Gstreamer. In addition to if statements in #6275 it'd be nice to support binary function call chains like cmp as well, which suffered the same issue:

self.0
    .hours
    .cmp(&other.0.hours)
    .then_with(|| self.0.minutes.cmp(&other.0.hours)) // Should be other.0.minutes
    .then_with(|| self.0.seconds.cmp(&other.0.seconds))
    .then_with(|| self.0.frames.cmp(&other.0.frames))

The expressions are separated by then_with and closures instead of a simple && binary op so this might be quite a stretch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions