Skip to content

integer_arithmetic gives unhelpful warnings for const expressions #1761

Closed
@ssokolow

Description

@ssokolow

I use the integer_arithmetic lint as a reminder to explicitly decide on what kind of behaviour I want, but it also triggers in situations like this line, where the math makes the line more readable and the *_mul methods aren't available.

pub const MAX_SCRIPT_SIZE: u64 = 1024 * 1024; // 1 MiB

It should probably be limited to non-constant expressions (or split into two lints) until an alternative is stabilized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.I-false-positiveIssue: The lint was triggered on code it shouldn't haveT-middleType: Probably requires verifiying types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions