Skip to content

Commit c5ce32c

Browse files
committed
fix: different felt display if alloc not enabled
1 parent 0f3e898 commit c5ce32c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

crates/starknet-types-core/src/patricia_key.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,19 @@ pub struct PatriciaKeyFromFeltError(Felt);
4848

4949
impl core::fmt::Display for PatriciaKeyFromFeltError {
5050
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
51-
write!(
51+
#[cfg(feature = "alloc")]
52+
return write!(
5253
f,
5354
"invalid felt value for patricia key. Upper non-inclusinve bound is 2^251 got {:#x}",
5455
self.0
55-
)
56+
);
57+
58+
#[cfg(not(feature = "alloc"))]
59+
return write!(
60+
f,
61+
"invalid felt value for patricia key. Upper non-inclusinve bound is 2^251 got {}",
62+
self.0
63+
);
5664
}
5765
}
5866

0 commit comments

Comments
 (0)