Skip to content

Fix description of unsigned checked_exact_div #144947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tautschnig
Copy link

Like its signed counterpart, this function does not panic. Also, fix the examples to document how it returns Some/None.

@rustbot
Copy link
Collaborator

rustbot commented Aug 5, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 5, 2025
@tautschnig tautschnig force-pushed the remove-stray-checked_div-comment branch from f244312 to 7e44d73 Compare August 5, 2025 09:05
Copy link
Contributor

@Kivooeo Kivooeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit

@tautschnig tautschnig force-pushed the remove-stray-checked_div-comment branch from 7e44d73 to 651cd0f Compare August 5, 2025 12:56
Copy link
Contributor

@xizheyin xizheyin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small suggestions. :)

///
/// This function will panic if `rhs == 0` or `self % rhs != 0`.
/// Checked integer division without remainder. Computes `self / rhs`,
/// returning `None` if `rhs == 0` or if `self % rhs != 0`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/// Returns `Some(self / rhs)` if `rhs` is not zero and `self` is evenly divisible by `rhs`.
/// Returns `None` otherwise.

A suggestion. We could mention both Some and None.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't seem to do this in any of the other checked_... functions, so I'd rather not introduce this change for only one function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, following convention is better :) Perhaps a follow up could be considered like this...

Like its signed counterpart, this function does not panic. Also, fix the
examples to document how it returns Some/None.
@tautschnig tautschnig force-pushed the remove-stray-checked_div-comment branch from 651cd0f to 9c0cfd2 Compare August 5, 2025 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants