about summary refs log tree commit diff
path: root/compiler/rustc_ast/src/tokenstream.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-12-11 12:29:04 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-12-18 10:31:39 +1100
commit3575e7943b4d4a47c30716c50884d4ceee1b7dcd (patch)
tree5da82514a016b43bbb8d5fee3660f124cd138e8c /compiler/rustc_ast/src/tokenstream.rs
parent0bf6e82c540c838c277ef3ae54c2ac125391dde9 (diff)
downloadrust-3575e7943b4d4a47c30716c50884d4ceee1b7dcd.tar.gz
rust-3575e7943b4d4a47c30716c50884d4ceee1b7dcd.zip
Simplify `RefTokenTreeCursor::look_ahead`.
It's only ever used with a lookahead of 0, so this commit removes the
lookahead and renames it `peek`.
Diffstat (limited to 'compiler/rustc_ast/src/tokenstream.rs')
-rw-r--r--compiler/rustc_ast/src/tokenstream.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs
index c6b6addc946..59e5ff9f7a5 100644
--- a/compiler/rustc_ast/src/tokenstream.rs
+++ b/compiler/rustc_ast/src/tokenstream.rs
@@ -678,8 +678,8 @@ impl<'t> RefTokenTreeCursor<'t> {
         RefTokenTreeCursor { stream, index: 0 }
     }
 
-    pub fn look_ahead(&self, n: usize) -> Option<&TokenTree> {
-        self.stream.0.get(self.index + n)
+    pub fn peek(&self) -> Option<&TokenTree> {
+        self.stream.0.get(self.index)
     }
 }