@@ -21,14 +21,7 @@ pub enum LiteralKind {
2121
2222impl fmt:: Display for LiteralKind {
2323 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
24- let label = match self {
25- LiteralKind :: Int => "Int" ,
26- LiteralKind :: Float => "Float" ,
27- LiteralKind :: Str => "Str" ,
28- LiteralKind :: Bool => "Bool" ,
29- LiteralKind :: Null => "Null" ,
30- } ;
31- write ! ( f, "{}" , label)
24+ fmt:: Debug :: fmt ( self , f)
3225 }
3326}
3427
@@ -47,13 +40,7 @@ pub enum NumericLiteralKind {
4740
4841impl fmt:: Display for NumericLiteralKind {
4942 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
50- let label = match self {
51- NumericLiteralKind :: Decimal => "Decimal" ,
52- NumericLiteralKind :: Hex => "Hex" ,
53- NumericLiteralKind :: Binary => "Binary" ,
54- NumericLiteralKind :: Octal => "Octal" ,
55- } ;
56- write ! ( f, "{}" , label)
43+ fmt:: Debug :: fmt ( self , f)
5744 }
5845}
5946
@@ -791,18 +778,7 @@ impl fmt::Display for TokenKind {
791778 if let Some ( lexeme) = self . static_lexeme ( ) {
792779 write ! ( f, "'{}'" , lexeme)
793780 } else {
794- let label = match self {
795- TokenKind :: Identifier => "Identifier" ,
796- TokenKind :: IntLiteral => "Integer Literal" ,
797- TokenKind :: FloatLiteral => "Float Literal" ,
798- TokenKind :: StringLiteral => "String Literal" ,
799- TokenKind :: FStringText => "f-string segment" ,
800- TokenKind :: Newline => "Newline" ,
801- TokenKind :: Eof => "EOF" ,
802- TokenKind :: Error => "Error" ,
803- _ => "Unknown Token" ,
804- } ;
805- write ! ( f, "{}" , label)
781+ fmt:: Debug :: fmt ( self , f)
806782 }
807783 }
808784}
0 commit comments