@@ -64,7 +64,20 @@ impl<'a> TokenTreesReader<'a> {
64
64
}
65
65
return Ok ( buf. into_token_stream ( ) ) ;
66
66
}
67
- _ => buf. push ( self . parse_token_tree_non_delim_non_eof ( ) ) ,
67
+ _ => {
68
+ // `this_spacing` for the returned token refers to whether the token is
69
+ // immediately followed by another op token. It is determined by the
70
+ // next token: its kind and its `preceded_by_whitespace` status.
71
+ let ( next_tok, is_next_tok_preceded_by_whitespace) =
72
+ self . string_reader . next_token ( ) ;
73
+ let this_spacing = if is_next_tok_preceded_by_whitespace || !next_tok. is_op ( ) {
74
+ Spacing :: Alone
75
+ } else {
76
+ Spacing :: Joint
77
+ } ;
78
+ let this_tok = std:: mem:: replace ( & mut self . token , next_tok) ;
79
+ buf. push ( TokenTree :: Token ( this_tok, this_spacing) )
80
+ }
68
81
}
69
82
}
70
83
}
@@ -235,21 +248,6 @@ impl<'a> TokenTreesReader<'a> {
235
248
err. span_label ( self . token . span , "unexpected closing delimiter" ) ;
236
249
err
237
250
}
238
-
239
- #[ inline]
240
- fn parse_token_tree_non_delim_non_eof ( & mut self ) -> TokenTree {
241
- // `this_spacing` for the returned token refers to whether the token is
242
- // immediately followed by another op token. It is determined by the
243
- // next token: its kind and its `preceded_by_whitespace` status.
244
- let ( next_tok, is_next_tok_preceded_by_whitespace) = self . string_reader . next_token ( ) ;
245
- let this_spacing = if is_next_tok_preceded_by_whitespace || !next_tok. is_op ( ) {
246
- Spacing :: Alone
247
- } else {
248
- Spacing :: Joint
249
- } ;
250
- let this_tok = std:: mem:: replace ( & mut self . token , next_tok) ;
251
- TokenTree :: Token ( this_tok, this_spacing)
252
- }
253
251
}
254
252
255
253
#[ derive( Default ) ]
0 commit comments