From 87d4dbc4188f4648ef0e9ac348667a84a5b88ccb Mon Sep 17 00:00:00 2001 From: lcnr/Bastian Kauschke Date: Tue, 26 Mar 2019 17:39:11 +0100 Subject: [PATCH] do not return &mut Self in set_one/zero --- src/identities.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/identities.rs b/src/identities.rs index 4a5a2b3..8deb01e 100644 --- a/src/identities.rs +++ b/src/identities.rs @@ -21,9 +21,8 @@ pub trait Zero: Sized + Add { /// Sets `self` to the additive identity element of `Self`, `0`. /// Returns `&mut self` to enable method chaining. - fn set_zero(&mut self) -> &mut Self { + fn set_zero(&mut self) { *self = Zero::zero(); - self } /// Returns `true` if `self` is equal to the additive identity. @@ -73,9 +72,8 @@ where self.0.is_zero() } - fn set_zero(&mut self) -> &mut Self { + fn set_zero(&mut self) { self.0.set_zero(); - self } fn zero() -> Self { @@ -103,10 +101,8 @@ pub trait One: Sized + Mul { fn one() -> Self; /// Sets `self` to the multiplicative identity element of `Self`, `1`. - /// Returns `&mut self` to enable method chaining. - fn set_one(&mut self) -> &mut Self { + fn set_one(&mut self) { *self = One::one(); - self } /// Returns `true` if `self` is equal to the multiplicative identity. @@ -161,9 +157,8 @@ impl One for Wrapping where Wrapping: Mul>, { - fn set_one(&mut self) -> &mut Self { + fn set_one(&mut self) { self.0.set_one(); - self } fn one() -> Self {