@@ -776,9 +776,8 @@ fn trim_selections(cx: &mut Context) {
776776fn align_selections(cx: &mut Context) {
777777 let align_style = cx.count();
778778 if align_style > 3 {
779− cx.editor.set_error(
780− "align only accept 1,2,3 as count to set left/center/right align".to_string(),
781− );
779+ cx.editor
780+ .set_error("align only accept 1,2,3 as count to set left/center/right align");
782781 return;
783782 }
784783
@@ -793,7 +792,7 @@ fn align_selections(cx: &mut Context) {
793792 let (l1, l2) = sel.line_range(text);
794793 if l1 != l2 {
795794 cx.editor
796− .set_error("align cannot work with multi line selections".to_string());
795+ .set_error("align cannot work with multi line selections");
797796 return;
798797 }
799798 // if the selection is not in the same line with last selection, we set the column to 0
@@ -1790,7 +1789,7 @@ fn global_search(cx: &mut Context) {
17901789 let call: job::Callback =
17911790 Box::new(move |editor: &mut Editor, compositor: &mut Compositor| {
17921791 if all_matches.is_empty() {
1793− editor.set_status("No matches found".to_string());
1792+ editor.set_status("No matches found");
17941793 return;
17951794 }
17961795
@@ -2177,10 +2176,10 @@ pub mod cmd {
21772176 if args.is_empty() {
21782177 let style = doc!(cx.editor).indent_style;
21792178 cx.editor.set_status(match style {
2180− Tabs => "tabs".into(),
2181− Spaces(1) => "1 space".into(),
2179+ Tabs => "tabs".to_owned(),
2180+ Spaces(1) => "1 space".to_owned(),
21822181 Spaces(n) if (2..=8).contains(&n) => format!("{} spaces", n),
2183− _ => "error".into(), // Shouldn't happen.
2182+ _ => unreachable!(), // Shouldn't happen.
21842183 });
21852184 return Ok(());
21862185 }
@@ -2216,14 +2215,14 @@ pub mod cmd {
22162215 if args.is_empty() {
22172216 let line_ending = doc!(cx.editor).line_ending;
22182217 cx.editor.set_status(match line_ending {
2219− Crlf => "crlf".into(),
2220− LF => "line feed".into(),
2221− FF => "form feed".into(),
2222− CR => "carriage return".into(),
2223− Nel => "next line".into(),
2218+ Crlf => "crlf",
2219+ LF => "line feed",
2220+ FF => "form feed",
2221+ CR => "carriage return",
2222+ Nel => "next line",
22242223
22252224 // These should never be a document's default line ending.
2226− VT | LS | PS => "error".into(),
2225+ VT | LS | PS => "error",
22272226 });
22282227
22292228 return Ok(());
@@ -2259,7 +2258,7 @@ pub mod cmd {
22592258 let (view, doc) = current!(cx.editor);
22602259 let success = doc.earlier(view.id, uk);
22612260 if !success {
2262− cx.editor.set_status("Already at oldest change".to_owned());
2261+ cx.editor.set_status("Already at oldest change");
22632262 }
22642263
22652264 Ok(())
@@ -2274,7 +2273,7 @@ pub mod cmd {
22742273 let (view, doc) = current!(cx.editor);
22752274 let success = doc.later(view.id, uk);
22762275 if !success {
2277− cx.editor.set_status("Already at newest change".to_owned());
2276+ cx.editor.set_status("Already at newest change");
22782277 }
22792278
22802279 Ok(())
@@ -2634,7 +2633,7 @@ pub mod cmd {
26342633 if let Some(label) = args.first() {
26352634 doc.set_encoding(label)
26362635 } else {
2637− let encoding = doc.encoding().name().to_string();
2636+ let encoding = doc.encoding().name().to_owned();
26382637 cx.editor.set_status(encoding);
26392638 Ok(())
26402639 }
@@ -3612,7 +3611,7 @@ pub fn code_action(cx: &mut Context) {
36123611 None => return,
36133612 };
36143613 if actions.is_empty() {
3615− editor.set_status("No code actions available".to_owned());
3614+ editor.set_status("No code actions available");
36163615 return;
36173616 }
36183617
@@ -3836,7 +3835,7 @@ fn last_picker(cx: &mut Context) {
38363835 compositor.push(picker);
38373836 }
38383837 // XXX: figure out how to show error when no last picker lifetime
3839− // cx.editor.set_error("no last picker".to_owned())
3838+ // cx.editor.set_error("no last picker")
38403839 }));
38413840}
38423841
@@ -4098,7 +4097,7 @@ fn goto_last_accessed_file(cx: &mut Context) {
40984097 if let Some(alt) = alternate_file {
40994098 cx.editor.switch(alt, Action::Replace);
41004099 } else {
4101− cx.editor.set_error("no last accessed buffer".to_owned())
4100+ cx.editor.set_error("no last accessed buffer")
41024101 }
41034102}
41044103
@@ -4125,7 +4124,7 @@ fn goto_last_modified_file(cx: &mut Context) {
41254124 if let Some(alt) = alternate_file {
41264125 cx.editor.switch(alt, Action::Replace);
41274126 } else {
4128− cx.editor.set_error("no last modified buffer".to_owned())
4127+ cx.editor.set_error("no last modified buffer")
41294128 }
41304129}
41314130
@@ -4196,7 +4195,7 @@ fn goto_impl(
41964195 jump_to(editor, location, offset_encoding, Action::Replace);
41974196 }
41984197 [] => {
4199− editor.set_error("No definition found.".to_string());
4198+ editor.set_error("No definition found.");
42004199 }
42014200 _locations => {
42024201 let picker = FilePicker::new(
@@ -4841,7 +4840,7 @@ fn undo(cx: &mut Context) {
48414840 let (view, doc) = current!(cx.editor);
48424841 for _ in 0..count {
48434842 if !doc.undo(view.id) {
4844− cx.editor.set_status("Already at oldest change".to_owned());
4843+ cx.editor.set_status("Already at oldest change");
48454844 break;
48464845 }
48474846 }
@@ -4852,7 +4851,7 @@ fn redo(cx: &mut Context) {
48524851 let (view, doc) = current!(cx.editor);
48534852 for _ in 0..count {
48544853 if !doc.redo(view.id) {
4855− cx.editor.set_status("Already at newest change".to_owned());
4854+ cx.editor.set_status("Already at newest change");
48564855 break;
48574856 }
48584857 }
@@ -4864,7 +4863,7 @@ fn earlier(cx: &mut Context) {
48644863 for _ in 0..count {
48654864 // rather than doing in batch we do this so get error halfway
48664865 if !doc.earlier(view.id, UndoKind::Steps(1)) {
4867− cx.editor.set_status("Already at oldest change".to_owned());
4866+ cx.editor.set_status("Already at oldest change");
48684867 break;
48694868 }
48704869 }
@@ -4876,7 +4875,7 @@ fn later(cx: &mut Context) {
48764875 for _ in 0..count {
48774876 // rather than doing in batch we do this so get error halfway
48784877 if !doc.later(view.id, UndoKind::Steps(1)) {
4879− cx.editor.set_status("Already at newest change".to_owned());
4878+ cx.editor.set_status("Already at newest change");
48804879 break;
48814880 }
48824881 }
@@ -4962,7 +4961,7 @@ fn yank_main_selection_to_clipboard_impl(
49624961 bail!("Couldn't set system clipboard content: {}", e);
49634962 }
49644963
4965− editor.set_status("yanked main selection to system clipboard".to_owned());
4964+ editor.set_status("yanked main selection to system clipboard");
49664965 Ok(())
49674966}
49684967
@@ -5399,7 +5398,7 @@ fn remove_primary_selection(cx: &mut Context) {
53995398
54005399 let selection = doc.selection(view.id);
54015400 if selection.len() == 1 {
5402− cx.editor.set_error("no selections remaining".to_owned());
5401+ cx.editor.set_error("no selections remaining");
54035402 return;
54045403 }
54055404 let index = selection.primary_index();
@@ -5506,7 +5505,7 @@ pub fn completion(cx: &mut Context) {
55065505 }
55075506
55085507 if items.is_empty() {
5509− // editor.set_error("No completion available".to_string());
5508+ // editor.set_error("No completion available");
55105509 return;
55115510 }
55125511 let size = compositor.size();
@@ -5787,8 +5786,7 @@ fn jump_backward(cx: &mut Context) {
57875786
57885787fn save_selection(cx: &mut Context) {
57895788 push_jump(cx.editor);
5790− cx.editor
5791− .set_status("Selection saved to jumplist".to_owned());
5789+ cx.editor.set_status("Selection saved to jumplist");
57925790}
57935791
57945792fn rotate_view(cx: &mut Context) {
@@ -6161,7 +6159,7 @@ fn shell_keep_pipe(cx: &mut Context) {
61616159 }
61626160
61636161 if ranges.is_empty() {
6164− cx.editor.set_error("No selections remaining".to_string());
6162+ cx.editor.set_error("No selections remaining");
61656163 return;
61666164 }
61676165
@@ -6247,7 +6245,7 @@ fn shell(cx: &mut Context, prompt: Cow<'static, str>, behavior: ShellBehavior) {
62476245 };
62486246
62496247 if !success {
6250− cx.editor.set_error("Command failed".to_string());
6248+ cx.editor.set_error("Command failed");
62516249 return;
62526250 }
62536251