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:
@@ -269,7 +269,15 @@ impl JsonLspAdapter {
|
||||
.await;
|
||||
|
||||
let config = cx.update(|cx| {
|
||||
Self::get_workspace_config(self.languages.language_names().clone(), adapter_schemas, cx)
|
||||
Self::get_workspace_config(
|
||||
self.languages
|
||||
.language_names()
|
||||
.into_iter()
|
||||
.map(|name| name.to_string())
|
||||
.collect(),
|
||||
adapter_schemas,
|
||||
cx,
|
||||
)
|
||||
})?;
|
||||
writer.replace(config.clone());
|
||||
return Ok(config);
|
||||
|
||||
Reference in New Issue
Block a user