From 31eec5e80c1a9a263482dfc9601f4cfc61e9e24b Mon Sep 17 00:00:00 2001 From: Fireassember Date: Wed, 11 Mar 2020 22:54:24 +0200 Subject: implementing Display for enums too. --- xtask/src/codegen/gen_syntax.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'xtask') 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 { } impl std::fmt::Display for #name { - fn fmt(..) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax()) + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) } } @@ -120,6 +120,12 @@ fn generate_ast(grammar: AstSrc<'_>) -> Result { } )* + impl std::fmt::Display for #name { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } + } + impl AstNode for #name { fn can_cast(kind: SyntaxKind) -> bool { match kind { -- cgit v1.2.3