Skip to content

u64::saturating_div is useless #122821

Open
Open
@ijackson

Description

@ijackson

pub const fn saturating_div(self, rhs: u64) -> u64

This function will panic if rhs is 0.

This makes no sense. The only way that u64 / u64 could overfllow is if rhs = 0.

The same is true for the other unsigned integer types. The signed types have the excuse that they wouldn't know whether to count division by zero as saturating to -ve or +ve maximum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions