-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
base: master
Are you sure you want to change the base?
Fix description of unsigned checked_exact_div
#144947
Conversation
rustbot has assigned @Mark-Simulacrum. Use |
f244312
to
7e44d73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit
7e44d73
to
651cd0f
Compare
There was a problem hiding this 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`. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
651cd0f
to
9c0cfd2
Compare
Like its signed counterpart, this function does not panic. Also, fix the examples to document how it returns Some/None.