fix
This commit is contained in:
parent
f3869040c7
commit
80052795ba
|
@ -22,7 +22,7 @@ pub trait Zero: Sized + Add<Self, Output = Self> {
|
||||||
fn zero() -> Self;
|
fn zero() -> Self;
|
||||||
|
|
||||||
/// Sets `self` to the additive identity element of `Self`, `0`.
|
/// Sets `self` to the additive identity element of `Self`, `0`.
|
||||||
/// This function may be faster than replacing self with `Zero::zero()`.
|
/// Returns `&mut self` to enable method chaining.
|
||||||
///
|
///
|
||||||
/// # Laws
|
/// # Laws
|
||||||
///
|
///
|
||||||
|
@ -30,10 +30,6 @@ pub trait Zero: Sized + Add<Self, Output = Self> {
|
||||||
/// a + 0 = a ∀ a ∈ Self
|
/// a + 0 = a ∀ a ∈ Self
|
||||||
/// 0 + a = a ∀ a ∈ Self
|
/// 0 + a = a ∀ a ∈ Self
|
||||||
/// ```
|
/// ```
|
||||||
///
|
|
||||||
/// # Purity
|
|
||||||
///
|
|
||||||
/// This function may return different results depending on the previous state of `self`.
|
|
||||||
fn to_zero(&mut self) -> &mut Self {
|
fn to_zero(&mut self) -> &mut Self {
|
||||||
mem::replace(self, Zero::zero());
|
mem::replace(self, Zero::zero());
|
||||||
self
|
self
|
||||||
|
@ -110,6 +106,7 @@ pub trait One: Sized + Mul<Self, Output = Self> {
|
||||||
fn one() -> Self;
|
fn one() -> Self;
|
||||||
|
|
||||||
/// Sets `self` to the multiplicative identity element of `Self`, `1`.
|
/// Sets `self` to the multiplicative identity element of `Self`, `1`.
|
||||||
|
/// Returns `&mut self` to enable method chaining.
|
||||||
///
|
///
|
||||||
/// # Laws
|
/// # Laws
|
||||||
///
|
///
|
||||||
|
@ -117,11 +114,7 @@ pub trait One: Sized + Mul<Self, Output = Self> {
|
||||||
/// a * 1 = a ∀ a ∈ Self
|
/// a * 1 = a ∀ a ∈ Self
|
||||||
/// 1 * a = a ∀ a ∈ Self
|
/// 1 * a = a ∀ a ∈ Self
|
||||||
/// ```
|
/// ```
|
||||||
///
|
fn to_one(&mut self) -> &mut Self {
|
||||||
/// # Purity
|
|
||||||
///
|
|
||||||
/// This function may return different results depending on the previous state of `self`.
|
|
||||||
fn to_zero(&mut self) -> &mut Self {
|
|
||||||
mem::replace(self, One::one());
|
mem::replace(self, One::one());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue