aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorKirawi2022-02-15 01:22:55 +0000
committerGitHub2022-02-15 01:22:55 +0000
commit23907a063c43f06f120d80a6ec0b6748881236a1 (patch)
treecaab2dc654fa25f86c1acdb21111570216d488a2 /helix-term/src/commands.rs
parent3a83a764e3a03ecf463c8fcfc141e48ed2d807ab (diff)
use PathBuf::to_string_lossy() instead of to_str() (#1655)
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 677943e8..5e3e1c43 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1792,9 +1792,8 @@ fn global_search(cx: &mut Context) {
all_matches,
move |(_line_num, path)| {
let relative_path = helix_core::path::get_relative_path(path)
- .to_str()
- .unwrap()
- .to_owned();
+ .to_string_lossy()
+ .into_owned();
if current_path.as_ref().map(|p| p == path).unwrap_or(false) {
format!("{} (*)", relative_path).into()
} else {
@@ -3536,9 +3535,8 @@ fn workspace_symbol_picker(cx: &mut Context) {
(&symbol.name).into()
} else {
let relative_path = helix_core::path::get_relative_path(path.as_path())
- .to_str()
- .unwrap()
- .to_owned();
+ .to_string_lossy()
+ .into_owned();
format!("{} ({})", &symbol.name, relative_path).into()
}
},
@@ -4209,8 +4207,8 @@ fn goto_impl(
.map(|path| path.to_path_buf())
.unwrap_or(path)
})
+ .map(|path| Cow::from(path.to_string_lossy().into_owned()))
.ok()
- .and_then(|path| path.to_str().map(|path| path.to_owned().into()))
})
.flatten()
.unwrap_or_else(|| location.uri.as_str().into());