We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d9c3c04 commit 83313daCopy full SHA for 83313da
crates/math/src/unsigned_integer/element.rs
@@ -109,12 +109,15 @@ impl<const NUM_LIMBS: usize> From<&str> for UnsignedInteger<NUM_LIMBS> {
109
110
impl<const NUM_LIMBS: usize> Display for UnsignedInteger<NUM_LIMBS> {
111
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
112
+ if f.alternate() {
113
+ write!(f, "0x")?;
114
+ }
115
+
116
let mut limbs_iterator = self.limbs.iter().skip_while(|limb| **limb == 0).peekable();
117
118
if limbs_iterator.peek().is_none() {
- write!(f, "0x0")?;
119
+ write!(f, "0")?;
120
} else {
- write!(f, "0x")?;
121
if let Some(most_significant_limb) = limbs_iterator.next() {
122
write!(f, "{most_significant_limb:x}")?;
123
}
0 commit comments