@@ -325,23 +325,21 @@ impl<'a> Parser<'a> {
325
325
* target_tokens = Some ( tokens. clone ( ) ) ;
326
326
}
327
327
328
- let final_attrs = ret. attrs ( ) ;
329
-
330
328
// If `capture_cfg` is set and we're inside a recursive call to
331
329
// `collect_tokens_trailing_token`, then we need to register a replace range
332
330
// if we have `#[cfg]` or `#[cfg_attr]`. This allows us to run eager cfg-expansion
333
331
// on the captured token stream.
334
332
if self . capture_cfg
335
333
&& matches ! ( self . capture_state. capturing, Capturing :: Yes )
336
- && has_cfg_or_cfg_attr ( final_attrs )
334
+ && has_cfg_or_cfg_attr ( ret . attrs ( ) )
337
335
{
338
336
assert ! ( !self . break_last_token, "Should not have unglued last token with cfg attr" ) ;
339
337
340
338
// Replace the entire AST node that we just parsed, including attributes, with
341
339
// `target`. If this AST node is inside an item that has `#[derive]`, then this will
342
340
// allow us to cfg-expand this AST node.
343
341
let start_pos = if has_outer_attrs { attrs. start_pos } else { start_pos } ;
344
- let target = AttrsTarget { attrs : final_attrs . iter ( ) . cloned ( ) . collect ( ) , tokens } ;
342
+ let target = AttrsTarget { attrs : ret . attrs ( ) . iter ( ) . cloned ( ) . collect ( ) , tokens } ;
345
343
self . capture_state . replace_ranges . push ( ( start_pos..end_pos, Some ( target) ) ) ;
346
344
self . capture_state . replace_ranges . extend ( inner_attr_replace_ranges) ;
347
345
} else if matches ! ( self . capture_state. capturing, Capturing :: No ) {
0 commit comments