diff options
author | Fireassember <[email protected]> | 2020-03-11 20:54:24 +0000 |
---|---|---|
committer | Fireassember <[email protected]> | 2020-03-11 20:54:24 +0000 |
commit | 31eec5e80c1a9a263482dfc9601f4cfc61e9e24b (patch) | |
tree | 671e87df1a94e6ce5dd9369d5e683cacc209a967 /xtask | |
parent | 787043496aaa05be31162a8cdd0686a13da646cc (diff) |
implementing Display for enums too.
Diffstat (limited to 'xtask')
-rw-r--r-- | xtask/src/codegen/gen_syntax.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs index 879f0243e..32afd47bc 100644 --- a/xtask/src/codegen/gen_syntax.rs +++ b/xtask/src/codegen/gen_syntax.rs | |||
@@ -69,8 +69,8 @@ fn generate_ast(grammar: AstSrc<'_>) -> Result<String> { | |||
69 | } | 69 | } |
70 | 70 | ||
71 | impl std::fmt::Display for #name { | 71 | impl std::fmt::Display for #name { |
72 | fn fmt(..) -> std::fmt::Result { | 72 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
73 | std::fmt::Display::fmt(self.syntax()) | 73 | std::fmt::Display::fmt(self.syntax(), f) |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
@@ -120,6 +120,12 @@ fn generate_ast(grammar: AstSrc<'_>) -> Result<String> { | |||
120 | } | 120 | } |
121 | )* | 121 | )* |
122 | 122 | ||
123 | impl std::fmt::Display for #name { | ||
124 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
125 | std::fmt::Display::fmt(self.syntax(), f) | ||
126 | } | ||
127 | } | ||
128 | |||
123 | impl AstNode for #name { | 129 | impl AstNode for #name { |
124 | fn can_cast(kind: SyntaxKind) -> bool { | 130 | fn can_cast(kind: SyntaxKind) -> bool { |
125 | match kind { | 131 | match kind { |