From 94162974f95f40cf2689c430c2684d98064d08f0 Mon Sep 17 00:00:00 2001 From: dasha_uwu Date: Fri, 6 Feb 2026 15:06:41 +0500 Subject: [PATCH] Fix validated math macro --- src/core/utils/math.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/core/utils/math.rs b/src/core/utils/math.rs index 0ae07777..2e3e6b0c 100644 --- a/src/core/utils/math.rs +++ b/src/core/utils/math.rs @@ -42,13 +42,12 @@ macro_rules! expected { #[collapse_debuginfo(yes)] macro_rules! validated { ($($input:tt)+) => { - //#[expect(clippy::arithmetic_side_effects)] { - //Some($($input)*) - // .ok_or_else(|| $crate::err!(Arithmetic("this error should never been seen"))) - //} - - //NOTE: remove me when stmt_expr_attributes is stable - $crate::expected!("validated arithmetic expression failed", $($input)+) + { + // TODO rewrite when stmt_expr_attributes is stable + #[expect(clippy::arithmetic_side_effects)] + let __res = ($($input)+); + __res + } }; } @@ -58,7 +57,9 @@ macro_rules! validated { #[macro_export] #[collapse_debuginfo(yes)] macro_rules! validated { - ($($input:tt)+) => { $crate::expected!($($input)+) } + ($($input:tt)+) => { + $crate::expected!("validated arithmetic expression failed", $($input)+) + } } #[inline]