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::{
30
30
/// conversion itself has zero runtime cost: ast and syntax nodes have exactly
31
31
/// the same representation: a pointer to the tree root and a pointer to the
32
32
/// node itself.
33
- pub trait AstNode {
33
+ pub trait AstNode : std :: fmt :: Display {
34
34
fn can_cast ( kind : SyntaxKind ) -> bool
35
35
where
36
36
Self : Sized ;
Original file line number Diff line number Diff line change @@ -68,6 +68,12 @@ fn generate_ast(grammar: AstSrc<'_>) -> Result<String> {
68
68
pub ( crate ) syntax: SyntaxNode ,
69
69
}
70
70
71
+ impl std:: fmt:: Display for #name {
72
+ fn fmt( ..) -> std:: fmt:: Result {
73
+ std:: fmt:: Display :: fmt( self . syntax( ) )
74
+ }
75
+ }
76
+
71
77
impl AstNode for #name {
72
78
fn can_cast( kind: SyntaxKind ) -> bool {
73
79
match kind {
You can’t perform that action at this time.
0 commit comments