Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/commands/typed.rs')
| -rw-r--r-- | helix-term/src/commands/typed.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 85cf6b1d..a1f8898f 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -222,7 +222,7 @@ fn buffer_gather_paths_impl(editor: &mut Editor, args: Args) -> Vec<DocumentId> for arg in args { let doc_id = editor.documents().find_map(|doc| { let arg_path = Some(Path::new(arg.as_ref())); - if doc.path().map(|p| p.as_path()) == arg_path || doc.relative_path() == arg_path { + if doc.path() == arg_path || doc.relative_path() == arg_path { Some(doc.id()) } else { None @@ -1511,11 +1511,11 @@ fn reload(cx: &mut compositor::Context, _args: Args, event: PromptEvent) -> anyh doc.reload(view, &cx.editor.diff_providers).map(|_| { view.ensure_cursor_in_view(doc, scrolloff); })?; - if let Some(path) = doc.path() { + if let Some(path) = doc.path().map(ToOwned::to_owned) { cx.editor .language_servers .file_event_handler - .file_changed(path.clone()); + .file_changed(path); } Ok(()) } @@ -1557,11 +1557,11 @@ fn reload_all(cx: &mut compositor::Context, _args: Args, event: PromptEvent) -> continue; } - if let Some(path) = doc.path() { + if let Some(path) = doc.path().map(ToOwned::to_owned) { cx.editor .language_servers .file_event_handler - .file_changed(path.clone()); + .file_changed(path); } for view_id in view_ids { @@ -2736,8 +2736,8 @@ fn move_buffer_impl( let doc = doc!(cx.editor); let old_path = doc .path() - .context("Scratch buffer cannot be moved. Use :write instead")? - .clone(); + .map(ToOwned::to_owned) + .context("Scratch buffer cannot be moved. Use :write instead")?; // if new_path is a directory, append the original file name // to move the file into that directory. |