Skip to content

Commit 53379a7

Browse files
committed
Simplify the ttdelim_span test.
The existing code is a very complex and inefficient way to the get the span of the last token.
1 parent 8771282 commit 53379a7

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

compiler/rustc_expand/src/parse/tests.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,7 @@ fn ttdelim_span() {
294294
.unwrap();
295295

296296
let ast::ExprKind::MacCall(mac) = &expr.kind else { panic!("not a macro") };
297-
let tts: Vec<_> = mac.args.tokens.clone().into_trees().collect();
298-
299-
let span = tts.iter().rev().next().unwrap().span();
297+
let span = mac.args.tokens.trees().last().unwrap().span();
300298

301299
match sess.source_map().span_to_snippet(span) {
302300
Ok(s) => assert_eq!(&s[..], "{ body }"),

0 commit comments

Comments
 (0)