From 736ec84b840c74d178fdf2dafaeffdd7ac7e5321 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 7 Feb 2024 17:24:46 -0800 Subject: [PATCH] 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 {