From 203cba76e07c87c4e665b2e78ca0358b5a72e86a Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 31 Jul 2023 15:53:46 +1000 Subject: [PATCH] Only call `parse_token_tree` once. This code currently uses a `while` loop and gathers token trees into a vector, but it only succeeds in the case where there is a single token tree. We can instead just call `parse_token_tree` once and then look for `Eof` to detect the success case. --- src/librustdoc/clean/render_macro_matchers.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/librustdoc/clean/render_macro_matchers.rs b/src/librustdoc/clean/render_macro_matchers.rs index b3dc0f63e45..66d10f2368b 100644 --- a/src/librustdoc/clean/render_macro_matchers.rs +++ b/src/librustdoc/clean/render_macro_matchers.rs @@ -76,14 +76,13 @@ fn snippet_equal_to_token(tcx: TyCtxt<'_>, matcher: &TokenTree) -> Option