Use into_owned over to_string for Cow<str> (#39024)
This removes unnecessary allocations when the `Cow` is already owned Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
@@ -178,7 +178,7 @@ impl PathKey {
|
||||
|
||||
pub fn for_buffer(buffer: &Entity<Buffer>, cx: &App) -> Self {
|
||||
if let Some(file) = buffer.read(cx).file() {
|
||||
Self::namespaced(1, file.full_path(cx).to_string_lossy().to_string().into())
|
||||
Self::namespaced(1, file.full_path(cx).to_string_lossy().into_owned().into())
|
||||
} else {
|
||||
Self::namespaced(0, buffer.entity_id().to_string().into())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user