File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ pub use self::{
3030/// conversion itself has zero runtime cost: ast and syntax nodes have exactly
3131/// the same representation: a pointer to the tree root and a pointer to the
3232/// node itself.
33- pub trait AstNode {
33+ pub trait AstNode : std :: fmt :: Display {
3434 fn can_cast ( kind : SyntaxKind ) -> bool
3535 where
3636 Self : Sized ;
Original file line number Diff line number Diff line change @@ -68,6 +68,12 @@ fn generate_ast(grammar: AstSrc<'_>) -> Result<String> {
6868 pub ( crate ) syntax: SyntaxNode ,
6969 }
7070
71+ impl std:: fmt:: Display for #name {
72+ fn fmt( ..) -> std:: fmt:: Result {
73+ std:: fmt:: Display :: fmt( self . syntax( ) )
74+ }
75+ }
76+
7177 impl AstNode for #name {
7278 fn can_cast( kind: SyntaxKind ) -> bool {
7379 match kind {
You can’t perform that action at this time.
0 commit comments