Inline and remove parse_all_token_trees
.
It has a single call site.
This commit is contained in:
parent
d9f2fdfaed
commit
db7b07aa02
@ -1251,7 +1251,7 @@ impl<'a> Parser<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Parses a single token tree from the input.
|
/// Parses a single token tree from the input.
|
||||||
pub(crate) fn parse_token_tree(&mut self) -> TokenTree {
|
pub fn parse_token_tree(&mut self) -> TokenTree {
|
||||||
match self.token.kind {
|
match self.token.kind {
|
||||||
token::OpenDelim(..) => {
|
token::OpenDelim(..) => {
|
||||||
// Grab the tokens within the delimiters.
|
// Grab the tokens within the delimiters.
|
||||||
@ -1287,15 +1287,6 @@ impl<'a> Parser<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses a stream of tokens into a list of `TokenTree`s, up to EOF.
|
|
||||||
pub fn parse_all_token_trees(&mut self) -> Vec<TokenTree> {
|
|
||||||
let mut tts = Vec::new();
|
|
||||||
while self.token != token::Eof {
|
|
||||||
tts.push(self.parse_token_tree());
|
|
||||||
}
|
|
||||||
tts
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn parse_tokens(&mut self) -> TokenStream {
|
pub fn parse_tokens(&mut self) -> TokenStream {
|
||||||
let mut result = Vec::new();
|
let mut result = Vec::new();
|
||||||
loop {
|
loop {
|
||||||
|
@ -76,7 +76,10 @@ fn snippet_equal_to_token(tcx: TyCtxt<'_>, matcher: &TokenTree) -> Option<String
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Reparse a single token tree.
|
// Reparse a single token tree.
|
||||||
let mut reparsed_trees = parser.parse_all_token_trees();
|
let mut reparsed_trees = Vec::new();
|
||||||
|
while parser.token != token::Eof {
|
||||||
|
reparsed_trees.push(parser.parse_token_tree());
|
||||||
|
}
|
||||||
if reparsed_trees.len() != 1 {
|
if reparsed_trees.len() != 1 {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user