From 86cc326d0665997669ca6069c5bb2619e1955f6c Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 17 May 2019 18:37:53 +1000 Subject: Avoid unnecessary interning in `Ident::from_str()` calls. A lot of these static symbols are pre-interned. --- src/libsyntax/ext/expand.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/libsyntax/ext') diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index a286fd83e3c..019ebc8566f 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1522,19 +1522,19 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { let include_info = vec![ ast::NestedMetaItem::MetaItem( attr::mk_name_value_item_str( - Ident::from_str("file"), + Ident::with_empty_ctxt(sym::file), dummy_spanned(file), ), ), ast::NestedMetaItem::MetaItem( attr::mk_name_value_item_str( - Ident::from_str("contents"), + Ident::with_empty_ctxt(sym::contents), dummy_spanned(src_interned), ), ), ]; - let include_ident = Ident::from_str("include"); + let include_ident = Ident::with_empty_ctxt(sym::include); let item = attr::mk_list_item(DUMMY_SP, include_ident, include_info); items.push(ast::NestedMetaItem::MetaItem(item)); } @@ -1600,7 +1600,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { } } - let meta = attr::mk_list_item(DUMMY_SP, Ident::from_str("doc"), items); + let meta = attr::mk_list_item(DUMMY_SP, Ident::with_empty_ctxt(sym::doc), items); match at.style { ast::AttrStyle::Inner => *at = attr::mk_spanned_attr_inner(at.span, at.id, meta), ast::AttrStyle::Outer => *at = attr::mk_spanned_attr_outer(at.span, at.id, meta), -- cgit 1.4.1-3-g733a5