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:
@@ -4631,7 +4631,7 @@ impl BufferSnapshot {
|
||||
pub fn resolve_file_path(&self, include_root: bool, cx: &App) -> Option<String> {
|
||||
if let Some(file) = self.file() {
|
||||
if file.path().file_name().is_none() || include_root {
|
||||
Some(file.full_path(cx).to_string_lossy().to_string())
|
||||
Some(file.full_path(cx).to_string_lossy().into_owned())
|
||||
} else {
|
||||
Some(file.path().display(file.path_style(cx)).to_string())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user