Inline and remove TokenTree::{open_tt,close_tt}
.
They both have a single call site.
This commit is contained in:
parent
ad566b78f2
commit
aefbbeec34
2 changed files with 2 additions and 12 deletions
|
@ -94,16 +94,6 @@ impl TokenTree {
|
|||
TokenTree::Token(Token::new(kind, span))
|
||||
}
|
||||
|
||||
/// Returns the opening delimiter as a token tree.
|
||||
pub fn open_tt(span: DelimSpan, delim: DelimToken) -> TokenTree {
|
||||
TokenTree::token(token::OpenDelim(delim), span.open)
|
||||
}
|
||||
|
||||
/// Returns the closing delimiter as a token tree.
|
||||
pub fn close_tt(span: DelimSpan, delim: DelimToken) -> TokenTree {
|
||||
TokenTree::token(token::CloseDelim(delim), span.close)
|
||||
}
|
||||
|
||||
pub fn uninterpolate(self) -> TokenTree {
|
||||
match self {
|
||||
TokenTree::Token(token) => TokenTree::Token(token.uninterpolate().into_owned()),
|
||||
|
|
|
@ -266,12 +266,12 @@ impl TokenCursor {
|
|||
loop {
|
||||
let (tree, spacing) = if !self.frame.open_delim {
|
||||
self.frame.open_delim = true;
|
||||
TokenTree::open_tt(self.frame.span, self.frame.delim).into()
|
||||
TokenTree::token(token::OpenDelim(self.frame.delim), self.frame.span.open).into()
|
||||
} else if let Some(tree) = self.frame.tree_cursor.next_with_spacing() {
|
||||
tree
|
||||
} else if !self.frame.close_delim {
|
||||
self.frame.close_delim = true;
|
||||
TokenTree::close_tt(self.frame.span, self.frame.delim).into()
|
||||
TokenTree::token(token::CloseDelim(self.frame.delim), self.frame.span.close).into()
|
||||
} else if let Some(frame) = self.stack.pop() {
|
||||
self.frame = frame;
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue