Skip to content

Commit 7a6a188

Browse files
committed
Add default fallback from divides to is_multiple_of
1 parent a51b3ff commit 7a6a188

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/lib.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,11 @@ pub trait Integer: Sized + Num + PartialOrd + Ord + Eq {
202202

203203
/// Deprecated, use `is_multiple_of` instead.
204204
#[deprecated(note = "Please use is_multiple_of instead")]
205-
fn divides(&self, other: &Self) -> bool;
205+
#[inline]
206+
fn divides(&self, other: &Self) -> bool {
207+
self.is_multiple_of(other)
208+
}
209+
206210

207211
/// Returns `true` if `self` is a multiple of `other`.
208212
///
@@ -526,12 +530,6 @@ macro_rules! impl_integer_for_isize {
526530
(gcd, lcm)
527531
}
528532

529-
/// Deprecated, use `is_multiple_of` instead.
530-
#[inline]
531-
fn divides(&self, other: &Self) -> bool {
532-
self.is_multiple_of(other)
533-
}
534-
535533
/// Returns `true` if the number is a multiple of `other`.
536534
#[inline]
537535
fn is_multiple_of(&self, other: &Self) -> bool {
@@ -893,12 +891,6 @@ macro_rules! impl_integer_for_usize {
893891
(gcd, lcm)
894892
}
895893

896-
/// Deprecated, use `is_multiple_of` instead.
897-
#[inline]
898-
fn divides(&self, other: &Self) -> bool {
899-
self.is_multiple_of(other)
900-
}
901-
902894
/// Returns `true` if the number is a multiple of `other`.
903895
#[inline]
904896
fn is_multiple_of(&self, other: &Self) -> bool {

0 commit comments

Comments
 (0)