Skip to content

arithmetic_side_effects should consider the conversion of primitives #15943

@c410-f3r

Description

@c410-f3r

The right-hand-side comes from an u8 that will never overflow when adding 86400.

use core::time::Duration;

#[deny(clippy::arithmetic_side_effects)]
pub fn from_days(days: u8) -> Duration {
    Duration::from_secs(86400 * u64::from(days))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions