about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-07-27 09:39:28 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2023-07-27 09:41:49 +1000
commit53379a7b65055fc272db1178f68c9cef9b4aa3bc (patch)
treeffccd4edcbfeb0acd93c59e8903f0ae66e08c34c
parent8771282d4e7a5c4569e49d1f878fb3ba90a974d0 (diff)
downloadrust-53379a7b65055fc272db1178f68c9cef9b4aa3bc.tar.gz
rust-53379a7b65055fc272db1178f68c9cef9b4aa3bc.zip
Simplify the `ttdelim_span` test.
The existing code is a very complex and inefficient way to the get the
span of the last token.
-rw-r--r--compiler/rustc_expand/src/parse/tests.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/rustc_expand/src/parse/tests.rs b/compiler/rustc_expand/src/parse/tests.rs
index 8b37728b60f..f891850963e 100644
--- a/compiler/rustc_expand/src/parse/tests.rs
+++ b/compiler/rustc_expand/src/parse/tests.rs
@@ -294,9 +294,7 @@ fn ttdelim_span() {
         .unwrap();
 
         let ast::ExprKind::MacCall(mac) = &expr.kind else { panic!("not a macro") };
-        let tts: Vec<_> = mac.args.tokens.clone().into_trees().collect();
-
-        let span = tts.iter().rev().next().unwrap().span();
+        let span = mac.args.tokens.trees().last().unwrap().span();
 
         match sess.source_map().span_to_snippet(span) {
             Ok(s) => assert_eq!(&s[..], "{ body }"),