Skip to content

Commit efdedcf

Browse files
committed
Simplified the Lcm and Gcd impl macros
1 parent 27cd6e0 commit efdedcf

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/utils/gcd.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ where
4343
}
4444
}
4545

46-
macro_rules! auto_impl_gcd {
47-
($($x:ty),+ $(,)?) => ($(
48-
impl $crate::utils::gcd::Gcd for $x {}
46+
macro_rules! gcd_impl {
47+
($name:ident for $($x:ty)*) => ($(
48+
impl $name for $x {}
4949
)*)
5050
}
5151

52-
auto_impl_gcd!(i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize);
52+
gcd_impl!(Gcd for i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize);

src/utils/lcm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ pub trait Lcm: Gcd {
1414
}
1515
}
1616

17-
macro_rules! auto_impl_lcm {
18-
($($x:ty),+ $(,)?) => ($(
19-
impl $crate::utils::lcm::Lcm for $x {}
17+
macro_rules! lcm_impl {
18+
($name:ident for $($x:ty)*) => ($(
19+
impl $name for $x {}
2020
)*)
2121
}
2222

23-
auto_impl_lcm!(i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize);
23+
lcm_impl!(Lcm for i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize);

0 commit comments

Comments
 (0)