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
@@ -50,7 +50,7 @@ impl WorktreeDelegate for WorktreeDelegateAdapter {
}
fn root_path(&self) -> String {
self.0.worktree_root_path().to_string_lossy().to_string()
self.0.worktree_root_path().to_string_lossy().into_owned()
}
async fn read_text_file(&self, path: &RelPath) -> Result<String> {
@@ -61,7 +61,7 @@ impl WorktreeDelegate for WorktreeDelegateAdapter {
self.0
.which(binary_name.as_ref())
.await
.map(|path| path.to_string_lossy().to_string())
.map(|path| path.to_string_lossy().into_owned())
}
async fn shell_env(&self) -> Vec<(String, String)> {