Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit aefbbee

Browse files
committed
Inline and remove TokenTree::{open_tt,close_tt}.
They both have a single call site.
1 parent ad566b7 commit aefbbee

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,6 @@ impl TokenTree {
9494
TokenTree::Token(Token::new(kind, span))
9595
}
9696

97-
/// Returns the opening delimiter as a token tree.
98-
pub fn open_tt(span: DelimSpan, delim: DelimToken) -> TokenTree {
99-
TokenTree::token(token::OpenDelim(delim), span.open)
100-
}
101-
102-
/// Returns the closing delimiter as a token tree.
103-
pub fn close_tt(span: DelimSpan, delim: DelimToken) -> TokenTree {
104-
TokenTree::token(token::CloseDelim(delim), span.close)
105-
}
106-
10797
pub fn uninterpolate(self) -> TokenTree {
10898
match self {
10999
TokenTree::Token(token) => TokenTree::Token(token.uninterpolate().into_owned()),

compiler/rustc_parse/src/parser/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,12 @@ impl TokenCursor {
266266
loop {
267267
let (tree, spacing) = if !self.frame.open_delim {
268268
self.frame.open_delim = true;
269-
TokenTree::open_tt(self.frame.span, self.frame.delim).into()
269+
TokenTree::token(token::OpenDelim(self.frame.delim), self.frame.span.open).into()
270270
} else if let Some(tree) = self.frame.tree_cursor.next_with_spacing() {
271271
tree
272272
} else if !self.frame.close_delim {
273273
self.frame.close_delim = true;
274-
TokenTree::close_tt(self.frame.span, self.frame.delim).into()
274+
TokenTree::token(token::CloseDelim(self.frame.delim), self.frame.span.close).into()
275275
} else if let Some(frame) = self.stack.pop() {
276276
self.frame = frame;
277277
continue;

0 commit comments

Comments
 (0)