diff --git a/units/src/amount/result.rs b/units/src/amount/result.rs index a8582a5e1..4d052ff6b 100644 --- a/units/src/amount/result.rs +++ b/units/src/amount/result.rs @@ -129,9 +129,7 @@ crate::internal_macros::impl_op_for_references! { fn add(self, rhs: Amount) -> Self::Output { self.checked_add(rhs).valid_or_error() } } -} -crate::internal_macros::impl_op_for_references! { impl ops::Add> for Amount { type Output = NumOpResult; diff --git a/units/src/internal_macros.rs b/units/src/internal_macros.rs index d65167518..d5d0f14d1 100644 --- a/units/src/internal_macros.rs +++ b/units/src/internal_macros.rs @@ -18,14 +18,14 @@ /// You must specify `$other_ty` and you may not use `Self`. So e.g. you need /// to write `impl ops::Add for Amount { ... }` when calling this macro. macro_rules! impl_op_for_references { - ( + ($( impl $($op_trait:ident)::+<$other_ty:ty> for $ty:ty { type Output = $($main_output:ty)*; fn $op:ident($($main_args:tt)*) -> Self::Output { $($main_impl:tt)* } } - ) => { + )+) => {$( impl $($op_trait)::+<$other_ty> for $ty { type Output = $($main_output)*; fn $op($($main_args)*) -> Self::Output { @@ -53,7 +53,7 @@ macro_rules! impl_op_for_references { (*self).$op(*rhs) } } - }; + )+}; } pub(crate) use impl_op_for_references;