languages: Remove a eager conversion from LanguageName
to String
(#35667)
This PR changes the signature of `language_names` from ```rust pub fn language_names(&self) -> Vec<String> // Into pub fn language_names(&self) -> Vec<LanguageName> ``` The function previously eagerly converted `LanguageName`'s to `String`'s, which requires the reallocation of all of the elements. The functions get called in many places in the code base, but only one of which actually requires the conversion to a `String`. In one case it would do a `SharedString` -> `String` -> `SharedString` conversion, which is now totally bypassed. Release Notes: - N/A
This commit is contained in:
parent
a508a9536f
commit
c595ed19d6
8 changed files with 44 additions and 28 deletions
|
@ -1015,15 +1015,13 @@ impl DebugDelegate {
|
|||
let language_names = languages.language_names();
|
||||
let language = dap_registry
|
||||
.adapter_language(&scenario.adapter)
|
||||
.map(|language| TaskSourceKind::Language {
|
||||
name: language.into(),
|
||||
});
|
||||
.map(|language| TaskSourceKind::Language { name: language.0 });
|
||||
|
||||
let language = language.or_else(|| {
|
||||
scenario.label.split_whitespace().find_map(|word| {
|
||||
language_names
|
||||
.iter()
|
||||
.find(|name| name.eq_ignore_ascii_case(word))
|
||||
.find(|name| name.as_ref().eq_ignore_ascii_case(word))
|
||||
.map(|name| TaskSourceKind::Language {
|
||||
name: name.to_owned().into(),
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue