@@ -391,6 +391,30 @@ macro_rules! make_ast_visitor {
391
391
return_result!( V )
392
392
}
393
393
394
+ pub fn walk_format_args<$( $lt, ) ? V : $trait$( <$lt>) ?>(
395
+ vis: & mut V ,
396
+ fmt: ref_t!( FormatArgs )
397
+ ) -> result!( V ) {
398
+ // FIXME: visit the template exhaustively.
399
+ let FormatArgs { span, template: _, arguments } = fmt;
400
+ let arg_iter = macro_if!{ $( $mut) ? {
401
+ arguments. all_args_mut( )
402
+ } else {
403
+ arguments. all_args( )
404
+ } } ;
405
+ for FormatArgument { kind, expr } in arg_iter {
406
+ match kind {
407
+ FormatArgumentKind :: Named ( ident) | FormatArgumentKind :: Captured ( ident) => {
408
+ try_v!( vis. visit_ident( ident) ) ;
409
+ }
410
+ FormatArgumentKind :: Normal => { }
411
+ }
412
+ try_v!( vis. visit_expr( expr) ) ;
413
+ }
414
+ try_v!( visit_span!( vis, span) ) ;
415
+ return_result!( V )
416
+ }
417
+
394
418
pub fn walk_generic_args<$( $lt, ) ? V : $trait$( <$lt>) ?>(
395
419
vis: & mut V ,
396
420
generic_args: ref_t!( GenericArgs )
@@ -1257,20 +1281,6 @@ pub mod visit {
1257
1281
visitor. visit_path ( path, * id)
1258
1282
}
1259
1283
1260
- pub fn walk_format_args < ' a , V : Visitor < ' a > > ( visitor : & mut V , fmt : & ' a FormatArgs ) -> V :: Result {
1261
- let FormatArgs { span : _, template : _, arguments } = fmt;
1262
- for FormatArgument { kind, expr } in arguments. all_args ( ) {
1263
- match kind {
1264
- FormatArgumentKind :: Named ( ident) | FormatArgumentKind :: Captured ( ident) => {
1265
- try_visit ! ( visitor. visit_ident( ident) )
1266
- }
1267
- FormatArgumentKind :: Normal => { }
1268
- }
1269
- try_visit ! ( visitor. visit_expr( expr) ) ;
1270
- }
1271
- V :: Result :: output ( )
1272
- }
1273
-
1274
1284
pub fn walk_expr < ' a , V : Visitor < ' a > > ( visitor : & mut V , expression : & ' a Expr ) -> V :: Result {
1275
1285
let Expr { id, kind, span, attrs, tokens : _ } = expression;
1276
1286
walk_list ! ( visitor, visit_attribute, attrs) ;
@@ -2597,21 +2607,6 @@ pub mod mut_visit {
2597
2607
vis. visit_path ( path) ;
2598
2608
}
2599
2609
2600
- fn walk_format_args < T : MutVisitor > ( vis : & mut T , fmt : & mut FormatArgs ) {
2601
- // FIXME: visit the template exhaustively.
2602
- let FormatArgs { span, template : _, arguments } = fmt;
2603
- for FormatArgument { kind, expr } in arguments. all_args_mut ( ) {
2604
- match kind {
2605
- FormatArgumentKind :: Named ( ident) | FormatArgumentKind :: Captured ( ident) => {
2606
- vis. visit_ident ( ident)
2607
- }
2608
- FormatArgumentKind :: Normal => { }
2609
- }
2610
- vis. visit_expr ( expr) ;
2611
- }
2612
- vis. visit_span ( span) ;
2613
- }
2614
-
2615
2610
pub fn walk_expr < T : MutVisitor > (
2616
2611
vis : & mut T ,
2617
2612
Expr { kind, id, span, attrs, tokens } : & mut Expr ,
0 commit comments