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:
@@ -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()
|
||||
|
||||
@@ -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))],
|
||||
|
||||
Reference in New Issue
Block a user