From 2db8cfd67d3177fddfa75c0b8024158fa699b33d Mon Sep 17 00:00:00 2001 From: Mario Rugiero Date: Wed, 4 Oct 2023 14:45:00 -0300 Subject: [PATCH] Return Option for u64 - Felt --- crates/stark-felt/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/stark-felt/src/lib.rs b/crates/stark-felt/src/lib.rs index 0093636..43ee8ae 100644 --- a/crates/stark-felt/src/lib.rs +++ b/crates/stark-felt/src/lib.rs @@ -556,18 +556,18 @@ mod arithmetic { /// Field subtraction. Never overflows/underflows. #[allow(clippy::suspicious_arithmetic_impl)] impl ops::Sub for u64 { - type Output = Felt; + type Output = Option; fn sub(self, rhs: Felt) -> Self::Output { - rhs.neg() + self + self + &rhs.neg() } } /// Field subtraction. Never overflows/underflows. #[allow(clippy::suspicious_arithmetic_impl)] impl ops::Sub<&Felt> for u64 { - type Output = Felt; + type Output = Option; fn sub(self, rhs: &Felt) -> Self::Output { - rhs.neg() + self + self + &rhs.neg() } }