@@ -65,12 +65,12 @@ impl ExternBlock {
6565 pub fn extern_item_list ( & self ) -> Option < ExternItemList > { support:: child ( & self . syntax ) }
6666}
6767#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
68- pub struct ExternCrateItem {
68+ pub struct ExternCrate {
6969 pub ( crate ) syntax : SyntaxNode ,
7070}
71- impl ast:: AttrsOwner for ExternCrateItem { }
72- impl ast:: VisibilityOwner for ExternCrateItem { }
73- impl ExternCrateItem {
71+ impl ast:: AttrsOwner for ExternCrate { }
72+ impl ast:: VisibilityOwner for ExternCrate { }
73+ impl ExternCrate {
7474 pub fn extern_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ extern] ) }
7575 pub fn crate_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ crate ] ) }
7676 pub fn name_ref ( & self ) -> Option < NameRef > { support:: child ( & self . syntax ) }
@@ -255,6 +255,21 @@ impl ItemList {
255255 pub fn r_curly_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ '}' ] ) }
256256}
257257#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
258+ pub struct NameRef {
259+ pub ( crate ) syntax : SyntaxNode ,
260+ }
261+ impl NameRef {
262+ pub fn ident_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ ident] ) }
263+ }
264+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
265+ pub struct Rename {
266+ pub ( crate ) syntax : SyntaxNode ,
267+ }
268+ impl ast:: NameOwner for Rename { }
269+ impl Rename {
270+ pub fn as_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ as ] ) }
271+ }
272+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
258273pub struct Abi {
259274 pub ( crate ) syntax : SyntaxNode ,
260275}
@@ -699,13 +714,6 @@ impl MethodCallExpr {
699714 pub fn type_arg_list ( & self ) -> Option < TypeArgList > { support:: child ( & self . syntax ) }
700715}
701716#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
702- pub struct NameRef {
703- pub ( crate ) syntax : SyntaxNode ,
704- }
705- impl NameRef {
706- pub fn ident_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ ident] ) }
707- }
708- #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
709717pub struct TypeArgList {
710718 pub ( crate ) syntax : SyntaxNode ,
711719}
@@ -1190,14 +1198,6 @@ impl UseTreeList {
11901198 pub fn r_curly_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ '}' ] ) }
11911199}
11921200#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1193- pub struct Rename {
1194- pub ( crate ) syntax : SyntaxNode ,
1195- }
1196- impl ast:: NameOwner for Rename { }
1197- impl Rename {
1198- pub fn as_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ as ] ) }
1199- }
1200- #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
12011201pub struct PathSegment {
12021202 pub ( crate ) syntax : SyntaxNode ,
12031203}
@@ -1272,7 +1272,7 @@ pub enum Item {
12721272 ConstDef ( ConstDef ) ,
12731273 EnumDef ( EnumDef ) ,
12741274 ExternBlock ( ExternBlock ) ,
1275- ExternCrateItem ( ExternCrateItem ) ,
1275+ ExternCrate ( ExternCrate ) ,
12761276 FnDef ( FnDef ) ,
12771277 ImplDef ( ImplDef ) ,
12781278 MacroCall ( MacroCall ) ,
@@ -1451,8 +1451,8 @@ impl AstNode for ExternBlock {
14511451 }
14521452 fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
14531453}
1454- impl AstNode for ExternCrateItem {
1455- fn can_cast ( kind : SyntaxKind ) -> bool { kind == EXTERN_CRATE_ITEM }
1454+ impl AstNode for ExternCrate {
1455+ fn can_cast ( kind : SyntaxKind ) -> bool { kind == EXTERN_CRATE }
14561456 fn cast ( syntax : SyntaxNode ) -> Option < Self > {
14571457 if Self :: can_cast ( syntax. kind ( ) ) {
14581458 Some ( Self { syntax } )
@@ -1605,6 +1605,28 @@ impl AstNode for ItemList {
16051605 }
16061606 fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
16071607}
1608+ impl AstNode for NameRef {
1609+ fn can_cast ( kind : SyntaxKind ) -> bool { kind == NAME_REF }
1610+ fn cast ( syntax : SyntaxNode ) -> Option < Self > {
1611+ if Self :: can_cast ( syntax. kind ( ) ) {
1612+ Some ( Self { syntax } )
1613+ } else {
1614+ None
1615+ }
1616+ }
1617+ fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
1618+ }
1619+ impl AstNode for Rename {
1620+ fn can_cast ( kind : SyntaxKind ) -> bool { kind == RENAME }
1621+ fn cast ( syntax : SyntaxNode ) -> Option < Self > {
1622+ if Self :: can_cast ( syntax. kind ( ) ) {
1623+ Some ( Self { syntax } )
1624+ } else {
1625+ None
1626+ }
1627+ }
1628+ fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
1629+ }
16081630impl AstNode for Abi {
16091631 fn can_cast ( kind : SyntaxKind ) -> bool { kind == ABI }
16101632 fn cast ( syntax : SyntaxNode ) -> Option < Self > {
@@ -2111,17 +2133,6 @@ impl AstNode for MethodCallExpr {
21112133 }
21122134 fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
21132135}
2114- impl AstNode for NameRef {
2115- fn can_cast ( kind : SyntaxKind ) -> bool { kind == NAME_REF }
2116- fn cast ( syntax : SyntaxNode ) -> Option < Self > {
2117- if Self :: can_cast ( syntax. kind ( ) ) {
2118- Some ( Self { syntax } )
2119- } else {
2120- None
2121- }
2122- }
2123- fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
2124- }
21252136impl AstNode for TypeArgList {
21262137 fn can_cast ( kind : SyntaxKind ) -> bool { kind == TYPE_ARG_LIST }
21272138 fn cast ( syntax : SyntaxNode ) -> Option < Self > {
@@ -2683,17 +2694,6 @@ impl AstNode for UseTreeList {
26832694 }
26842695 fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
26852696}
2686- impl AstNode for Rename {
2687- fn can_cast ( kind : SyntaxKind ) -> bool { kind == RENAME }
2688- fn cast ( syntax : SyntaxNode ) -> Option < Self > {
2689- if Self :: can_cast ( syntax. kind ( ) ) {
2690- Some ( Self { syntax } )
2691- } else {
2692- None
2693- }
2694- }
2695- fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
2696- }
26972697impl AstNode for PathSegment {
26982698 fn can_cast ( kind : SyntaxKind ) -> bool { kind == PATH_SEGMENT }
26992699 fn cast ( syntax : SyntaxNode ) -> Option < Self > {
@@ -2780,8 +2780,8 @@ impl From<EnumDef> for Item {
27802780impl From < ExternBlock > for Item {
27812781 fn from ( node : ExternBlock ) -> Item { Item :: ExternBlock ( node) }
27822782}
2783- impl From < ExternCrateItem > for Item {
2784- fn from ( node : ExternCrateItem ) -> Item { Item :: ExternCrateItem ( node) }
2783+ impl From < ExternCrate > for Item {
2784+ fn from ( node : ExternCrate ) -> Item { Item :: ExternCrate ( node) }
27852785}
27862786impl From < FnDef > for Item {
27872787 fn from ( node : FnDef ) -> Item { Item :: FnDef ( node) }
@@ -2816,9 +2816,9 @@ impl From<UseItem> for Item {
28162816impl AstNode for Item {
28172817 fn can_cast ( kind : SyntaxKind ) -> bool {
28182818 match kind {
2819- CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE_ITEM | FN_DEF | IMPL_DEF
2820- | MACRO_CALL | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS_DEF
2821- | UNION_DEF | USE_ITEM => true ,
2819+ CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN_DEF | IMPL_DEF | MACRO_CALL
2820+ | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | UNION_DEF
2821+ | USE_ITEM => true ,
28222822 _ => false ,
28232823 }
28242824 }
@@ -2827,7 +2827,7 @@ impl AstNode for Item {
28272827 CONST_DEF => Item :: ConstDef ( ConstDef { syntax } ) ,
28282828 ENUM_DEF => Item :: EnumDef ( EnumDef { syntax } ) ,
28292829 EXTERN_BLOCK => Item :: ExternBlock ( ExternBlock { syntax } ) ,
2830- EXTERN_CRATE_ITEM => Item :: ExternCrateItem ( ExternCrateItem { syntax } ) ,
2830+ EXTERN_CRATE => Item :: ExternCrate ( ExternCrate { syntax } ) ,
28312831 FN_DEF => Item :: FnDef ( FnDef { syntax } ) ,
28322832 IMPL_DEF => Item :: ImplDef ( ImplDef { syntax } ) ,
28332833 MACRO_CALL => Item :: MacroCall ( MacroCall { syntax } ) ,
@@ -2847,7 +2847,7 @@ impl AstNode for Item {
28472847 Item :: ConstDef ( it) => & it. syntax ,
28482848 Item :: EnumDef ( it) => & it. syntax ,
28492849 Item :: ExternBlock ( it) => & it. syntax ,
2850- Item :: ExternCrateItem ( it) => & it. syntax ,
2850+ Item :: ExternCrate ( it) => & it. syntax ,
28512851 Item :: FnDef ( it) => & it. syntax ,
28522852 Item :: ImplDef ( it) => & it. syntax ,
28532853 Item :: MacroCall ( it) => & it. syntax ,
@@ -3480,7 +3480,7 @@ impl std::fmt::Display for ExternBlock {
34803480 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
34813481 }
34823482}
3483- impl std:: fmt:: Display for ExternCrateItem {
3483+ impl std:: fmt:: Display for ExternCrate {
34843484 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
34853485 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
34863486 }
@@ -3550,6 +3550,16 @@ impl std::fmt::Display for ItemList {
35503550 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
35513551 }
35523552}
3553+ impl std:: fmt:: Display for NameRef {
3554+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
3555+ std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
3556+ }
3557+ }
3558+ impl std:: fmt:: Display for Rename {
3559+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
3560+ std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
3561+ }
3562+ }
35533563impl std:: fmt:: Display for Abi {
35543564 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
35553565 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
@@ -3780,11 +3790,6 @@ impl std::fmt::Display for MethodCallExpr {
37803790 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
37813791 }
37823792}
3783- impl std:: fmt:: Display for NameRef {
3784- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
3785- std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
3786- }
3787- }
37883793impl std:: fmt:: Display for TypeArgList {
37893794 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
37903795 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
@@ -4040,11 +4045,6 @@ impl std::fmt::Display for UseTreeList {
40404045 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
40414046 }
40424047}
4043- impl std:: fmt:: Display for Rename {
4044- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
4045- std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
4046- }
4047- }
40484048impl std:: fmt:: Display for PathSegment {
40494049 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
40504050 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
0 commit comments