mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 04:55:22 +03:00
Address nits and tidy errors.
This commit is contained in:
+15
-13
@@ -634,8 +634,8 @@ pub fn checked_div(self, rhs: Self) -> Option<Self> {
|
||||
}
|
||||
|
||||
doc_comment! {
|
||||
concat!("Checked Euclidean division. Computes `self.div_euc(rhs)`, returning `None` if `rhs == 0`
|
||||
or the division results in overflow.
|
||||
concat!("Checked Euclidean division. Computes `self.div_euc(rhs)`,
|
||||
returning `None` if `rhs == 0` or the division results in overflow.
|
||||
|
||||
# Examples
|
||||
|
||||
@@ -1047,8 +1047,8 @@ pub fn wrapping_div(self, rhs: Self) -> Self {
|
||||
}
|
||||
|
||||
doc_comment! {
|
||||
concat!("Wrapping Euclidean division. Computes `self.div_euc(rhs)`, wrapping around at the
|
||||
boundary of the type.
|
||||
concat!("Wrapping Euclidean division. Computes `self.div_euc(rhs)`,
|
||||
wrapping around at the boundary of the type.
|
||||
|
||||
The only case where such wrapping can occur is when one divides `MIN / -1` on a signed type (where
|
||||
`MIN` is the negative minimal value for the type); this is equivalent to `-MIN`, a positive value
|
||||
@@ -1462,7 +1462,7 @@ pub fn overflowing_rem(self, rhs: Self) -> (Self, bool) {
|
||||
|
||||
|
||||
doc_comment! {
|
||||
concat!("Calculates the modulo of Euclidean divsion `self.mod_euc(rhs)`.
|
||||
concat!("Calculates the remainder `self.mod_euc(rhs)` by Euclidean division.
|
||||
|
||||
Returns a tuple of the remainder after dividing along with a boolean indicating whether an
|
||||
arithmetic overflow would occur. If an overflow would occur then 0 is returned.
|
||||
@@ -1691,8 +1691,8 @@ pub fn pow(self, mut exp: u32) -> Self {
|
||||
doc_comment! {
|
||||
concat!("Calculates the quotient of Euclidean division of `self` by `rhs`.
|
||||
|
||||
This computes the integer n such that `self = n * rhs + self.mod_euc(rhs)`.
|
||||
In other words, the result is `self / rhs` rounded to the integer n
|
||||
This computes the integer `n` such that `self = n * rhs + self.mod_euc(rhs)`.
|
||||
In other words, the result is `self / rhs` rounded to the integer `n`
|
||||
such that `self >= n * rhs`.
|
||||
|
||||
# Panics
|
||||
@@ -1727,7 +1727,7 @@ pub fn div_euc(self, rhs: Self) -> Self {
|
||||
|
||||
|
||||
doc_comment! {
|
||||
concat!("Calculates the modulo `self mod rhs` by Euclidean division.
|
||||
concat!("Calculates the remainder `self mod rhs` by Euclidean division.
|
||||
|
||||
In particular, the result `n` satisfies `0 <= n < rhs.abs()`.
|
||||
|
||||
@@ -2720,7 +2720,7 @@ pub fn wrapping_div(self, rhs: Self) -> Self {
|
||||
#[unstable(feature = "euclidean_division", issue = "49048")]
|
||||
#[inline]
|
||||
pub fn wrapping_div_euc(self, rhs: Self) -> Self {
|
||||
self.div_euc(rhs)
|
||||
self / rhs
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3018,7 +3018,8 @@ pub fn overflowing_div(self, rhs: Self) -> (Self, bool) {
|
||||
Basic usage
|
||||
|
||||
```
|
||||
", $Feature, "assert_eq!(5", stringify!($SelfT), ".overflowing_div_euc(2), (2, false));", $EndFeature, "
|
||||
", $Feature, "assert_eq!(5", stringify!($SelfT), ".overflowing_div_euc(2), (2, false));",
|
||||
$EndFeature, "
|
||||
```"),
|
||||
#[inline]
|
||||
#[unstable(feature = "euclidean_division", issue = "49048")]
|
||||
@@ -3054,7 +3055,7 @@ pub fn overflowing_rem(self, rhs: Self) -> (Self, bool) {
|
||||
}
|
||||
|
||||
doc_comment! {
|
||||
concat!("Calculates the modulo of Euclidean division of `self.mod_euc(rhs)`.
|
||||
concat!("Calculates the remainder `self.mod_euc(rhs)` by Euclidean division.
|
||||
|
||||
Returns a tuple of the modulo after dividing along with a boolean
|
||||
indicating whether an arithmetic overflow would occur. Note that for
|
||||
@@ -3070,7 +3071,8 @@ pub fn overflowing_rem(self, rhs: Self) -> (Self, bool) {
|
||||
Basic usage
|
||||
|
||||
```
|
||||
", $Feature, "assert_eq!(5", stringify!($SelfT), ".overflowing_mod_euc(2), (1, false));", $EndFeature, "
|
||||
", $Feature, "assert_eq!(5", stringify!($SelfT), ".overflowing_mod_euc(2), (1, false));",
|
||||
$EndFeature, "
|
||||
```"),
|
||||
#[inline]
|
||||
#[unstable(feature = "euclidean_division", issue = "49048")]
|
||||
@@ -3259,7 +3261,7 @@ pub fn div_euc(self, rhs: Self) -> Self {
|
||||
|
||||
|
||||
doc_comment! {
|
||||
concat!("Calculates the Euclidean modulo `self mod rhs`.
|
||||
concat!("Calculates the remainder `self mod rhs` by Euclidean division.
|
||||
|
||||
For unsigned types, this is just the same as `self % rhs`.
|
||||
|
||||
|
||||
+2
-2
@@ -331,9 +331,9 @@ pub fn mul_add(self, a: f32, b: f32) -> f32 {
|
||||
|
||||
/// Calculates Euclidean division, the matching method for `mod_euc`.
|
||||
///
|
||||
/// This computes the integer n such that
|
||||
/// This computes the integer `n` such that
|
||||
/// `self = n * rhs + self.mod_euc(rhs)`.
|
||||
/// In other words, the result is `self / rhs` rounded to the integer n
|
||||
/// In other words, the result is `self / rhs` rounded to the integer `n`
|
||||
/// such that `self >= n * rhs`.
|
||||
///
|
||||
/// ```
|
||||
|
||||
+2
-2
@@ -317,9 +317,9 @@ pub fn mul_add(self, a: f64, b: f64) -> f64 {
|
||||
|
||||
/// Calculates Euclidean division, the matching method for `mod_euc`.
|
||||
///
|
||||
/// This computes the integer n such that
|
||||
/// This computes the integer `n` such that
|
||||
/// `self = n * rhs + self.mod_euc(rhs)`.
|
||||
/// In other words, the result is `self / rhs` rounded to the integer n
|
||||
/// In other words, the result is `self / rhs` rounded to the integer `n`
|
||||
/// such that `self >= n * rhs`.
|
||||
///
|
||||
/// ```
|
||||
|
||||
Reference in New Issue
Block a user