Skip to content

Commit db7b07a

Browse files
committed
Inline and remove parse_all_token_trees.
It has a single call site.
1 parent d9f2fdf commit db7b07a

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

compiler/rustc_parse/src/parser/mod.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ impl<'a> Parser<'a> {
12511251
}
12521252

12531253
/// Parses a single token tree from the input.
1254-
pub(crate) fn parse_token_tree(&mut self) -> TokenTree {
1254+
pub fn parse_token_tree(&mut self) -> TokenTree {
12551255
match self.token.kind {
12561256
token::OpenDelim(..) => {
12571257
// Grab the tokens within the delimiters.
@@ -1287,15 +1287,6 @@ impl<'a> Parser<'a> {
12871287
}
12881288
}
12891289

1290-
/// Parses a stream of tokens into a list of `TokenTree`s, up to EOF.
1291-
pub fn parse_all_token_trees(&mut self) -> Vec<TokenTree> {
1292-
let mut tts = Vec::new();
1293-
while self.token != token::Eof {
1294-
tts.push(self.parse_token_tree());
1295-
}
1296-
tts
1297-
}
1298-
12991290
pub fn parse_tokens(&mut self) -> TokenStream {
13001291
let mut result = Vec::new();
13011292
loop {

src/librustdoc/clean/render_macro_matchers.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ fn snippet_equal_to_token(tcx: TyCtxt<'_>, matcher: &TokenTree) -> Option<String
7676
};
7777

7878
// Reparse a single token tree.
79-
let mut reparsed_trees = parser.parse_all_token_trees();
79+
let mut reparsed_trees = Vec::new();
80+
while parser.token != token::Eof {
81+
reparsed_trees.push(parser.parse_token_tree());
82+
}
8083
if reparsed_trees.len() != 1 {
8184
return None;
8285
}

0 commit comments

Comments
 (0)