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:
@@ -46,7 +46,7 @@ impl PythonDebugAdapter {
|
||||
"Using user-installed debugpy adapter from: {}",
|
||||
user_installed_path.display()
|
||||
);
|
||||
vec![user_installed_path.to_string_lossy().to_string()]
|
||||
vec![user_installed_path.to_string_lossy().into_owned()]
|
||||
} else {
|
||||
let adapter_path = paths::debug_adapters_dir().join(Self::DEBUG_ADAPTER_NAME.as_ref());
|
||||
let path = adapter_path
|
||||
@@ -264,7 +264,7 @@ impl PythonDebugAdapter {
|
||||
name = delegate
|
||||
.which(OsStr::new(cmd))
|
||||
.await
|
||||
.map(|path| path.to_string_lossy().to_string());
|
||||
.map(|path| path.to_string_lossy().into_owned());
|
||||
if name.is_some() {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user