File tree Expand file tree Collapse file tree 1 file changed +1
-23
lines changed
crates/starknet-types-core/src/felt Expand file tree Collapse file tree 1 file changed +1
-23
lines changed Original file line number Diff line number Diff line change @@ -750,29 +750,7 @@ mod formatting {
750
750
/// Represents [Felt] in decimal by default.
751
751
impl fmt:: Display for Felt {
752
752
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
753
- if * self == Felt :: ZERO {
754
- return write ! ( f, "0" ) ;
755
- }
756
-
757
- let mut buf = [ 0u8 ; 4 * 20 ] ;
758
- let mut i = buf. len ( ) - 1 ;
759
- let mut current = self . 0 . representative ( ) ;
760
- let ten = UnsignedInteger :: from ( 10_u16 ) ;
761
-
762
- loop {
763
- let ( quotient, remainder) = current. div_rem ( & ten) ;
764
- let digit = remainder. limbs [ 3 ] as u8 ;
765
- buf[ i] = digit + b'0' ;
766
- current = quotient;
767
- if current == UnsignedInteger :: from ( 0_u16 ) {
768
- break ;
769
- }
770
- i -= 1 ;
771
- }
772
-
773
- // sequence of `'0'..'9'` chars is guaranteed to be a valid UTF8 string
774
- let s = core:: str:: from_utf8 ( & buf[ i..] ) . unwrap ( ) ;
775
- fmt:: Display :: fmt ( s, f)
753
+ write ! ( f, "{}" , self . to_biguint( ) )
776
754
}
777
755
}
778
756
You can’t perform that action at this time.
0 commit comments