From a935481ae9052d42c39af1d71c8e8e64750c9e02 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 21 Oct 2016 10:31:53 +1100 Subject: [PATCH] Avoid an unnecessary clone in `macro_parser::parse`. This avoids ~800,000 allocations in html5ever. --- src/libsyntax/ext/tt/macro_parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index ef2e466a043..a664e115ce4 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -425,8 +425,8 @@ pub fn parse(sess: &ParseSess, cur_eis.push(ei); } TokenTree::Token(_, ref t) => { - let mut ei_t = ei.clone(); if token_name_eq(t,&tok) { + let mut ei_t = ei.clone(); ei_t.idx += 1; next_eis.push(ei_t); }