@@ -639,10 +639,16 @@ impl ForType {
639639pub struct FormatArgsArg {
640640 pub ( crate ) syntax : SyntaxNode ,
641641}
642- impl ast:: HasName for FormatArgsArg { }
643642impl FormatArgsArg {
643+ #[ inline]
644+ pub fn arg_name ( & self ) -> Option < FormatArgsArgName > { support:: child ( & self . syntax ) }
644645 #[ inline]
645646 pub fn expr ( & self ) -> Option < Expr > { support:: child ( & self . syntax ) }
647+ }
648+ pub struct FormatArgsArgName {
649+ pub ( crate ) syntax : SyntaxNode ,
650+ }
651+ impl FormatArgsArgName {
646652 #[ inline]
647653 pub fn eq_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ =] ) }
648654}
@@ -3722,6 +3728,38 @@ impl fmt::Debug for FormatArgsArg {
37223728 f. debug_struct ( "FormatArgsArg" ) . field ( "syntax" , & self . syntax ) . finish ( )
37233729 }
37243730}
3731+ impl AstNode for FormatArgsArgName {
3732+ #[ inline]
3733+ fn kind ( ) -> SyntaxKind
3734+ where
3735+ Self : Sized ,
3736+ {
3737+ FORMAT_ARGS_ARG_NAME
3738+ }
3739+ #[ inline]
3740+ fn can_cast ( kind : SyntaxKind ) -> bool { kind == FORMAT_ARGS_ARG_NAME }
3741+ #[ inline]
3742+ fn cast ( syntax : SyntaxNode ) -> Option < Self > {
3743+ if Self :: can_cast ( syntax. kind ( ) ) { Some ( Self { syntax } ) } else { None }
3744+ }
3745+ #[ inline]
3746+ fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
3747+ }
3748+ impl hash:: Hash for FormatArgsArgName {
3749+ fn hash < H : hash:: Hasher > ( & self , state : & mut H ) { self . syntax . hash ( state) ; }
3750+ }
3751+ impl Eq for FormatArgsArgName { }
3752+ impl PartialEq for FormatArgsArgName {
3753+ fn eq ( & self , other : & Self ) -> bool { self . syntax == other. syntax }
3754+ }
3755+ impl Clone for FormatArgsArgName {
3756+ fn clone ( & self ) -> Self { Self { syntax : self . syntax . clone ( ) } }
3757+ }
3758+ impl fmt:: Debug for FormatArgsArgName {
3759+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
3760+ f. debug_struct ( "FormatArgsArgName" ) . field ( "syntax" , & self . syntax ) . finish ( )
3761+ }
3762+ }
37253763impl AstNode for FormatArgsExpr {
37263764 #[ inline]
37273765 fn kind ( ) -> SyntaxKind
@@ -8947,7 +8985,6 @@ impl AstNode for AnyHasName {
89478985 | CONST_PARAM
89488986 | ENUM
89498987 | FN
8950- | FORMAT_ARGS_ARG
89518988 | IDENT_PAT
89528989 | MACRO_DEF
89538990 | MACRO_RULES
@@ -9006,10 +9043,6 @@ impl From<Fn> for AnyHasName {
90069043 #[ inline]
90079044 fn from ( node : Fn ) -> AnyHasName { AnyHasName { syntax : node. syntax } }
90089045}
9009- impl From < FormatArgsArg > for AnyHasName {
9010- #[ inline]
9011- fn from ( node : FormatArgsArg ) -> AnyHasName { AnyHasName { syntax : node. syntax } }
9012- }
90139046impl From < IdentPat > for AnyHasName {
90149047 #[ inline]
90159048 fn from ( node : IdentPat ) -> AnyHasName { AnyHasName { syntax : node. syntax } }
@@ -9541,6 +9574,11 @@ impl std::fmt::Display for FormatArgsArg {
95419574 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
95429575 }
95439576}
9577+ impl std:: fmt:: Display for FormatArgsArgName {
9578+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
9579+ std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
9580+ }
9581+ }
95449582impl std:: fmt:: Display for FormatArgsExpr {
95459583 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
95469584 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
0 commit comments