@@ -14,6 +14,7 @@ use crate::{
1414 ui::{self, Completion, Picker, Popup, Prompt, PromptEvent},
1515};
1616
17+use std::borrow::Cow;
1718use std::path::{Path, PathBuf};
1819
1920use helix_view::{
@@ -333,7 +334,7 @@ where
333334 let text = doc.text().slice(..);
334335
335336 let selection = doc.selection(view_id).transform(|mut range| {
336− if let Some(pos) = search::find_nth_next(text, ch, range.head, count, inclusive) {
337+ search::find_nth_next(text, ch, range.head, count, inclusive).map_or(range, |pos| {
337338 if extend {
338339 Range::new(range.anchor, pos)
339340 } else {
@@ -341,9 +342,7 @@ where
341342 Range::new(range.head, pos)
342343 }
343344 // or (pos, pos) to move to found val
344− } else {
345− range
346− }
345+ })
347346 });
348347
349348 doc.set_selection(view_id, selection);
@@ -642,7 +641,7 @@ fn _search(doc: &mut Document, view_id: ViewId, contents: &str, regex: &Regex) {
642641 let start = doc.selection(view_id).cursor();
643642
644643 // TODO: use find_at to find the next match after the cursor, loop around the end
645− if let Some(mat) = regex.find_at(&contents, start) {
644+ if let Some(mat) = regex.find_at(contents, start) {
646645 let start = text.byte_to_char(mat.start());
647646 let end = text.byte_to_char(mat.end());
648647 let selection = Selection::single(start, end - 1);
@@ -859,15 +858,15 @@ pub fn command_mode(cx: &mut Context) {
859858 let parts = input.split_ascii_whitespace().collect::<Vec<&str>>();
860859
861860 match *parts.as_slice() {
862− ["q"] | ["quit"] => {
861+ ["q" | "quit"] => {
863862 editor.close(editor.view().id);
864863 // editor.should_close = true,
865864 }
866− ["o", path] | ["open", path] => {
865+ ["o" | "open", path] => {
867866 use helix_view::editor::Action;
868867 editor.open(path.into(), Action::Replace);
869868 }
870− ["w"] | ["write"] => {
869+ ["w" | "write"] => {
871870 // TODO: non-blocking via save() command
872871 let id = editor.view().doc;
873872 let doc = &mut editor.documents[id];
@@ -1487,7 +1486,7 @@ pub fn yank(cx: &mut Context) {
14871486 let values: Vec<String> = doc
14881487 .selection(view_id)
14891488 .fragments(doc.text().slice(..))
1490− .map(|cow| cow.into_owned())
1489+ .map(Cow::into_owned)
14911490 .collect();
14921491
14931492 // TODO: allow specifying reg