From 3ae21d5111444f5e01f6cfb1a2b9b314f66418a3 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Mon, 3 Mar 2025 13:16:10 +1100 Subject: [PATCH] Use impl_add/sub_assign for block interval We have a macro for implementing `AddAssign` and `SubAssign`. Use the macro, gets us an additional ref impl for both. --- units/src/block.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/units/src/block.rs b/units/src/block.rs index a402853fd..5d0dc90b8 100644 --- a/units/src/block.rs +++ b/units/src/block.rs @@ -223,13 +223,8 @@ crate::internal_macros::impl_op_for_references! { } } -impl ops::AddAssign for BlockInterval { - fn add_assign(&mut self, rhs: BlockInterval) { self.0 = self.to_u32() + rhs.to_u32(); } -} - -impl ops::SubAssign for BlockInterval { - fn sub_assign(&mut self, rhs: BlockInterval) { self.0 = self.to_u32() - rhs.to_u32(); } -} +crate::internal_macros::impl_add_assign!(BlockInterval); +crate::internal_macros::impl_sub_assign!(BlockInterval); impl core::iter::Sum for BlockInterval { fn sum>(iter: I) -> Self {