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:
Lukas Wirth
2025-09-27 14:50:10 +00:00
committed by GitHub
parent a063a70cfb
commit 72948e14ee
84 changed files with 169 additions and 161 deletions
+2 -2
View File
@@ -858,9 +858,9 @@ impl Vim {
let filename = if let Some(file) = buffer.read(cx).file() {
if count.is_some() {
if let Some(local) = file.as_local() {
local.abs_path(cx).to_string_lossy().to_string()
local.abs_path(cx).to_string_lossy().into_owned()
} else {
file.full_path(cx).to_string_lossy().to_string()
file.full_path(cx).to_string_lossy().into_owned()
}
} else {
file.path().display(file.path_style(cx)).into_owned()
+1 -1
View File
@@ -1610,7 +1610,7 @@ impl PickerDelegate for MarksViewDelegate {
let (right_output, right_runs): (String, Vec<_>) = match &mark_match.info {
MarksMatchInfo::Path(path) => {
let s = path.to_string_lossy().to_string();
let s = path.to_string_lossy().into_owned();
(
s.clone(),
vec![(0..s.len(), HighlightStyle::color(cx.theme().colors().text))],