Skip to content

Commit 2db8cfd

Browse files
committed
Return Option<u64> for u64 - Felt
1 parent 0befb53 commit 2db8cfd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/stark-felt/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,18 +556,18 @@ mod arithmetic {
556556
/// Field subtraction. Never overflows/underflows.
557557
#[allow(clippy::suspicious_arithmetic_impl)]
558558
impl ops::Sub<Felt> for u64 {
559-
type Output = Felt;
559+
type Output = Option<u64>;
560560
fn sub(self, rhs: Felt) -> Self::Output {
561-
rhs.neg() + self
561+
self + &rhs.neg()
562562
}
563563
}
564564

565565
/// Field subtraction. Never overflows/underflows.
566566
#[allow(clippy::suspicious_arithmetic_impl)]
567567
impl ops::Sub<&Felt> for u64 {
568-
type Output = Felt;
568+
type Output = Option<u64>;
569569
fn sub(self, rhs: &Felt) -> Self::Output {
570-
rhs.neg() + self
570+
self + &rhs.neg()
571571
}
572572
}
573573

0 commit comments

Comments
 (0)