Skip to content

precedence should not warn for unary minus before odd function #4892

Closed
@mad-s

Description

@mad-s

The clippy:precedence list currently warns on every instance of the form -literal.method(), as precedence looks ambiguous. However, for an odd function, i.e. a function f(x) where f(-x)=-f(x), the precedence doesn't matter. Many functions have this property, such as sin(), atan(), cbrt(), to_radians() (and round() i think).

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesgood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions