Auto merge of #95697 - klensy:no-strings, r=petrochenkov

refactor: simplify few string related interactions

Few small optimizations:

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.
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 FxHashSet<Symbol> instead of BTreeSet<String>
CrateInfo.crate_name replace FxHashMap<CrateNum, String> with FxHashMap<CrateNum, Symbol>
This commit is contained in:
bors 2022-04-09 13:15:26 +00:00
commit 8c1fb2eb23
15 changed files with 56 additions and 65 deletions

View file

@ -104,7 +104,7 @@ pub fn expand_include<'cx>(
return DummyResult::any(sp);
};
// The file will be added to the code map by the parser
let file = match resolve_path(cx, file, sp) {
let file = match resolve_path(cx, file.as_str(), sp) {
Ok(f) => f,
Err(mut err) => {
err.emit();
@ -176,7 +176,7 @@ pub fn expand_include_str(
let Some(file) = get_single_str_from_tts(cx, sp, tts, "include_str!") else {
return DummyResult::any(sp);
};
let file = match resolve_path(cx, file, sp) {
let file = match resolve_path(cx, file.as_str(), sp) {
Ok(f) => f,
Err(mut err) => {
err.emit();
@ -210,7 +210,7 @@ pub fn expand_include_bytes(
let Some(file) = get_single_str_from_tts(cx, sp, tts, "include_bytes!") else {
return DummyResult::any(sp);
};
let file = match resolve_path(cx, file, sp) {
let file = match resolve_path(cx, file.as_str(), sp) {
Ok(f) => f,
Err(mut err) => {
err.emit();