@@ -254,33 +254,38 @@ struct TokenCursor {
254254}
255255
256256impl TokenCursor {
257- fn next ( & mut self , desugar_doc_comments : bool ) -> ( Token , Spacing ) {
258- self . inlined_next ( desugar_doc_comments )
257+ fn next ( & mut self ) -> ( Token , Spacing ) {
258+ self . inlined_next ( )
259259 }
260260
261261 /// This always-inlined version should only be used on hot code paths.
262262 #[ inline( always) ]
263- fn inlined_next ( & mut self , desugar_doc_comments : bool ) -> ( Token , Spacing ) {
263+ fn inlined_next ( & mut self ) -> ( Token , Spacing ) {
264264 loop {
265265 // FIXME: we currently don't return `Delimiter` open/close delims. To fix #67062 we will
266266 // need to, whereupon the `delim != Delimiter::Invisible` conditions below can be
267267 // removed.
268268 if let Some ( tree) = self . tree_cursor . next_ref ( ) {
269269 match tree {
270- & TokenTree :: Token ( ref token, spacing) => match ( desugar_doc_comments, token) {
271- ( true , & Token { kind : token:: DocComment ( _, attr_style, data) , span } ) => {
272- let desugared = self . desugar ( attr_style, data, span) ;
273- self . tree_cursor . replace_prev_and_rewind ( desugared) ;
274- // Continue to get the first token of the desugared doc comment.
275- }
276- _ => {
277- debug_assert ! ( !matches!(
278- token. kind,
279- token:: OpenDelim ( _) | token:: CloseDelim ( _)
280- ) ) ;
281- return ( token. clone ( ) , spacing) ;
270+ & TokenTree :: Token ( ref token, spacing) => {
271+ match ( self . desugar_doc_comments , token) {
272+ (
273+ true ,
274+ & Token { kind : token:: DocComment ( _, attr_style, data) , span } ,
275+ ) => {
276+ let desugared = self . desugar ( attr_style, data, span) ;
277+ self . tree_cursor . replace_prev_and_rewind ( desugared) ;
278+ // Continue to get the first token of the desugared doc comment.
279+ }
280+ _ => {
281+ debug_assert ! ( !matches!(
282+ token. kind,
283+ token:: OpenDelim ( _) | token:: CloseDelim ( _)
284+ ) ) ;
285+ return ( token. clone ( ) , spacing) ;
286+ }
282287 }
283- } ,
288+ }
284289 & TokenTree :: Delimited ( sp, delim, ref tts) => {
285290 let trees = tts. clone ( ) . into_trees ( ) ;
286291 self . stack . push ( ( mem:: replace ( & mut self . tree_cursor , trees) , delim, sp) ) ;
@@ -1105,7 +1110,7 @@ impl<'a> Parser<'a> {
11051110 pub fn bump ( & mut self ) {
11061111 // Note: destructuring here would give nicer code, but it was found in #96210 to be slower
11071112 // than `.0`/`.1` access.
1108- let mut next = self . token_cursor . inlined_next ( self . token_cursor . desugar_doc_comments ) ;
1113+ let mut next = self . token_cursor . inlined_next ( ) ;
11091114 self . token_cursor . num_next_calls += 1 ;
11101115 // We've retrieved an token from the underlying
11111116 // cursor, so we no longer need to worry about
@@ -1155,7 +1160,7 @@ impl<'a> Parser<'a> {
11551160 let mut i = 0 ;
11561161 let mut token = Token :: dummy ( ) ;
11571162 while i < dist {
1158- token = cursor. next ( cursor . desugar_doc_comments ) . 0 ;
1163+ token = cursor. next ( ) . 0 ;
11591164 if matches ! (
11601165 token. kind,
11611166 token:: OpenDelim ( Delimiter :: Invisible ) | token:: CloseDelim ( Delimiter :: Invisible )
0 commit comments