From a51b3ffd4b1d434c57cff3f72f9918e6903dce6f Mon Sep 17 00:00:00 2001 From: aobatact Date: Wed, 28 Apr 2021 22:47:15 +0900 Subject: [PATCH 1/2] Mark Integer::divides as deprecated. --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index 073c1f8..0a97f63 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -201,6 +201,7 @@ pub trait Integer: Sized + Num + PartialOrd + Ord + Eq { } /// Deprecated, use `is_multiple_of` instead. + #[deprecated(note = "Please use is_multiple_of instead")] fn divides(&self, other: &Self) -> bool; /// Returns `true` if `self` is a multiple of `other`. From 736ec84b840c74d178fdf2dafaeffdd7ac7e5321 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 7 Feb 2024 17:24:46 -0800 Subject: [PATCH 2/2] Add default fallback from divides to is_multiple_of --- src/lib.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0a97f63..c0b84f0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -202,7 +202,10 @@ pub trait Integer: Sized + Num + PartialOrd + Ord + Eq { /// Deprecated, use `is_multiple_of` instead. #[deprecated(note = "Please use is_multiple_of instead")] - fn divides(&self, other: &Self) -> bool; + #[inline] + fn divides(&self, other: &Self) -> bool { + self.is_multiple_of(other) + } /// Returns `true` if `self` is a multiple of `other`. /// @@ -526,12 +529,6 @@ macro_rules! impl_integer_for_isize { (gcd, lcm) } - /// Deprecated, use `is_multiple_of` instead. - #[inline] - fn divides(&self, other: &Self) -> bool { - self.is_multiple_of(other) - } - /// Returns `true` if the number is a multiple of `other`. #[inline] fn is_multiple_of(&self, other: &Self) -> bool { @@ -893,12 +890,6 @@ macro_rules! impl_integer_for_usize { (gcd, lcm) } - /// Deprecated, use `is_multiple_of` instead. - #[inline] - fn divides(&self, other: &Self) -> bool { - self.is_multiple_of(other) - } - /// Returns `true` if the number is a multiple of `other`. #[inline] fn is_multiple_of(&self, other: &Self) -> bool {