@@ -155,11 +155,7 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi
155155 files,
156156 move |path: &PathBuf| {
157157 // format_fn
158− path.strip_prefix(&root)
159− .unwrap_or(path)
160− .to_str()
161− .unwrap()
162− .into()
158+ path.strip_prefix(&root).unwrap_or(path).to_string_lossy()
163159 },
164160 move |cx, path: &PathBuf, action| {
165161 cx.editor
@@ -288,7 +284,7 @@ pub mod completers {
288284 } else {
289285 let file_name = path
290286 .file_name()
291− .map(|file| file.to_str().unwrap().to_owned());
287+ .and_then(|file| file.to_str().map(|path| path.to_owned()));
292288
293289 let path = match path.parent() {
294290 Some(path) if !path.as_os_str().is_empty() => path.to_path_buf(),
@@ -331,7 +327,7 @@ pub mod completers {
331327 path.push("");
332328 }
333329
334− let path = path.to_str().unwrap().to_owned();
330+ let path = path.to_str()?.to_owned();
335331 Some((end.clone(), Cow::from(path)))
336332 })
337333 }) // TODO: unwrap or skip