Skip to content

Document / adjust operator precedence lint #13966

@dhardy

Description

@dhardy

Description

The precedence lint flags some stuff which is (IMO) unintuitive:

`1 << 2 + 3` 

But also some stuff which is (again, IMO) clearer:

`u64::from(data[1]) << 32 | u64::from(data[0])` 

The lint does not flag some stuff which is widely understood:

`2 * 3 - 1` 

The lint documentation could be more precise about which operator combinations get flagged, with a link to the reference on operator expression precedence.

Further, the lint could be disagglomerated or adjusted to allow the bit-shift with binary-and/or/xor case above.

Version

 

Additional Labels

No response

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