1
Fork 0

check_doc_keyword: don't alloc string for emptiness check

check_doc_alias_value: get argument as Symbol to prevent needless string convertions

check_doc_attrs: don't alloc vec, iterate over slice. Vec introduced in #83149, but no perf run posted on merge

replace as_str() check with symbol check

get_single_str_from_tts: don't prealloc string

trivial string to str replace

LifetimeScopeForPath::NonElided use Vec<Symbol> instead of Vec<String>

AssertModuleSource use BTreeSet<Symbol> instead of BTreeSet<String>

CrateInfo.crate_name replace FxHashMap<CrateNum, String> with FxHashMap<CrateNum, Symbol>
This commit is contained in:
klensy 2022-04-05 15:52:53 +03:00
parent f262ca12aa
commit d0cc98689e
15 changed files with 56 additions and 65 deletions

View file

@ -1215,7 +1215,7 @@ pub fn get_single_str_from_tts(
sp: Span,
tts: TokenStream,
name: &str,
) -> Option<String> {
) -> Option<Symbol> {
let mut p = cx.new_parser_from_tts(tts);
if p.token == token::Eof {
cx.span_err(sp, &format!("{} takes 1 argument", name));
@ -1227,7 +1227,7 @@ pub fn get_single_str_from_tts(
if p.token != token::Eof {
cx.span_err(sp, &format!("{} takes 1 argument", name));
}
expr_to_string(cx, ret, "argument must be a string literal").map(|(s, _)| s.to_string())
expr_to_string(cx, ret, "argument must be a string literal").map(|(s, _)| s)
}
/// Extracts comma-separated expressions from `tts`.