Skip to content

Commit 73ff5c8

Browse files
authored
fix(NonZeroFelt): invalid assert! usage inside const fn (#154)
1 parent ee6e92b commit 73ff5c8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

crates/starknet-types-core/src/felt/non_zero.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ impl NonZeroFelt {
1919
/// # Safety
2020
/// If the value is zero will panic.
2121
pub const fn from_raw(value: [u64; 4]) -> Self {
22-
assert!(
23-
value[0] != 0 || value[1] != 0 || value[2] != 0 || value[3] != 0,
24-
"Felt is zero"
25-
);
22+
if value[0] == 0 && value[1] == 0 && value[2] == 0 && value[3] == 0 {
23+
panic!("Felt is zero");
24+
}
2625
let value = Felt::from_raw(value);
2726
Self(value.0)
2827
}

0 commit comments

Comments
 (0)