@@ -776,9 +776,8 @@ fn trim_selections(cx: &mut Context) {
776fn align_selections(cx: &mut Context) {
776fn align_selections(cx: &mut Context) {
777 let align_style = cx.count();
777 let align_style = cx.count();
778 if align_style > 3 {
778 if align_style > 3 {
779− cx.editor.set_error(
779+ cx.editor
780− "align only accept 1,2,3 as count to set left/center/right align".to_string(),
780+ .set_error("align only accept 1,2,3 as count to set left/center/right align");
@@ -793,7 +792,7 @@ fn align_selections(cx: &mut Context) {
793 let (l1, l2) = sel.line_range(text);
792 let (l1, l2) = sel.line_range(text);
794 if l1 != l2 {
793 if l1 != l2 {
795 cx.editor
794 cx.editor
796− .set_error("align cannot work with multi line selections".to_string());
795+ .set_error("align cannot work with multi line selections");
799 // if the selection is not in the same line with last selection, we set the column to 0
798 // 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) {
1790 let call: job::Callback =
1789 let call: job::Callback =
1791 Box::new(move |editor: &mut Editor, compositor: &mut Compositor| {
1790 Box::new(move |editor: &mut Editor, compositor: &mut Compositor| {
1792 if all_matches.is_empty() {
1791 if all_matches.is_empty() {
1793− editor.set_status("No matches found".to_string());
1792+ editor.set_status("No matches found");
@@ -2177,10 +2176,10 @@ pub mod cmd {
2177 if args.is_empty() {
2176 if args.is_empty() {
2178 let style = doc!(cx.editor).indent_style;
2177 let style = doc!(cx.editor).indent_style;
2179 cx.editor.set_status(match style {
2178 cx.editor.set_status(match style {
2180− Tabs => "tabs".into(),
2179+ Tabs => "tabs".to_owned(),
2181− Spaces(1) => "1 space".into(),
2180+ Spaces(1) => "1 space".to_owned(),
2182 Spaces(n) if (2..=8).contains(&n) => format!("{} spaces", n),
2181 Spaces(n) if (2..=8).contains(&n) => format!("{} spaces", n),
2183− _ => "error".into(), // Shouldn't happen.
2182+ _ => unreachable!(), // Shouldn't happen.
2185 return Ok(());
2184 return Ok(());
@@ -2216,14 +2215,14 @@ pub mod cmd {
2216 if args.is_empty() {
2215 if args.is_empty() {
2217 let line_ending = doc!(cx.editor).line_ending;
2216 let line_ending = doc!(cx.editor).line_ending;
2218 cx.editor.set_status(match line_ending {
2217 cx.editor.set_status(match line_ending {
2219− Crlf => "crlf".into(),
2218+ Crlf => "crlf",
2220− LF => "line feed".into(),
2219+ LF => "line feed",
2221− FF => "form feed".into(),
2220+ FF => "form feed",
2222− CR => "carriage return".into(),
2221+ CR => "carriage return",
2223− Nel => "next line".into(),
2222+ Nel => "next line",
2225 // These should never be a document's default line ending.
2224 // These should never be a document's default line ending.
2226− VT | LS | PS => "error".into(),
2225+ VT | LS | PS => "error",
2229 return Ok(());
2228 return Ok(());
@@ -2259,7 +2258,7 @@ pub mod cmd {
2259 let (view, doc) = current!(cx.editor);
2258 let (view, doc) = current!(cx.editor);
2260 let success = doc.earlier(view.id, uk);
2259 let success = doc.earlier(view.id, uk);
2261 if !success {
2260 if !success {
2262− cx.editor.set_status("Already at oldest change".to_owned());
2261+ cx.editor.set_status("Already at oldest change");
@@ -2274,7 +2273,7 @@ pub mod cmd {
2274 let (view, doc) = current!(cx.editor);
2273 let (view, doc) = current!(cx.editor);
2275 let success = doc.later(view.id, uk);
2274 let success = doc.later(view.id, uk);
2276 if !success {
2275 if !success {
2277− cx.editor.set_status("Already at newest change".to_owned());
2276+ cx.editor.set_status("Already at newest change");
@@ -2634,7 +2633,7 @@ pub mod cmd {
2634 if let Some(label) = args.first() {
2633 if let Some(label) = args.first() {
2635 doc.set_encoding(label)
2634 doc.set_encoding(label)
2636 } else {
2635 } else {
2637− let encoding = doc.encoding().name().to_string();
2636+ let encoding = doc.encoding().name().to_owned();
2638 cx.editor.set_status(encoding);
2637 cx.editor.set_status(encoding);
@@ -3612,7 +3611,7 @@ pub fn code_action(cx: &mut Context) {
3612 None => return,
3611 None => return,
3614 if actions.is_empty() {
3613 if actions.is_empty() {
3615− editor.set_status("No code actions available".to_owned());
3614+ editor.set_status("No code actions available");
@@ -3836,7 +3835,7 @@ fn last_picker(cx: &mut Context) {
3836 compositor.push(picker);
3835 compositor.push(picker);
3838 // XXX: figure out how to show error when no last picker lifetime
3837 // 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")
@@ -4098,7 +4097,7 @@ fn goto_last_accessed_file(cx: &mut Context) {
4098 if let Some(alt) = alternate_file {
4097 if let Some(alt) = alternate_file {
4099 cx.editor.switch(alt, Action::Replace);
4098 cx.editor.switch(alt, Action::Replace);
4100 } else {
4099 } else {
4101− cx.editor.set_error("no last accessed buffer".to_owned())
4100+ cx.editor.set_error("no last accessed buffer")
@@ -4125,7 +4124,7 @@ fn goto_last_modified_file(cx: &mut Context) {
4125 if let Some(alt) = alternate_file {
4124 if let Some(alt) = alternate_file {
4126 cx.editor.switch(alt, Action::Replace);
4125 cx.editor.switch(alt, Action::Replace);
4127 } else {
4126 } else {
4128− cx.editor.set_error("no last modified buffer".to_owned())
4127+ cx.editor.set_error("no last modified buffer")
@@ -4196,7 +4195,7 @@ fn goto_impl(
4196 jump_to(editor, location, offset_encoding, Action::Replace);
4195 jump_to(editor, location, offset_encoding, Action::Replace);
4199− editor.set_error("No definition found.".to_string());
4198+ editor.set_error("No definition found.");
4201 _locations => {
4200 _locations => {
4202 let picker = FilePicker::new(
4201 let picker = FilePicker::new(
@@ -4841,7 +4840,7 @@ fn undo(cx: &mut Context) {
4841 let (view, doc) = current!(cx.editor);
4840 let (view, doc) = current!(cx.editor);
4842 for _ in 0..count {
4841 for _ in 0..count {
4843 if !doc.undo(view.id) {
4842 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");
@@ -4852,7 +4851,7 @@ fn redo(cx: &mut Context) {
4852 let (view, doc) = current!(cx.editor);
4851 let (view, doc) = current!(cx.editor);
4853 for _ in 0..count {
4852 for _ in 0..count {
4854 if !doc.redo(view.id) {
4853 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");
@@ -4864,7 +4863,7 @@ fn earlier(cx: &mut Context) {
4864 for _ in 0..count {
4863 for _ in 0..count {
4865 // rather than doing in batch we do this so get error halfway
4864 // rather than doing in batch we do this so get error halfway
4866 if !doc.earlier(view.id, UndoKind::Steps(1)) {
4865 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");
@@ -4876,7 +4875,7 @@ fn later(cx: &mut Context) {
4876 for _ in 0..count {
4875 for _ in 0..count {
4877 // rather than doing in batch we do this so get error halfway
4876 // rather than doing in batch we do this so get error halfway
4878 if !doc.later(view.id, UndoKind::Steps(1)) {
4877 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");
@@ -4962,7 +4961,7 @@ fn yank_main_selection_to_clipboard_impl(
4962 bail!("Couldn't set system clipboard content: {}", e);
4961 bail!("Couldn't set system clipboard content: {}", e);
4965− editor.set_status("yanked main selection to system clipboard".to_owned());
4964+ editor.set_status("yanked main selection to system clipboard");
@@ -5399,7 +5398,7 @@ fn remove_primary_selection(cx: &mut Context) {
5400 let selection = doc.selection(view.id);
5399 let selection = doc.selection(view.id);
5401 if selection.len() == 1 {
5400 if selection.len() == 1 {
5402− cx.editor.set_error("no selections remaining".to_owned());
5401+ cx.editor.set_error("no selections remaining");
5405 let index = selection.primary_index();
5404 let index = selection.primary_index();
@@ -5506,7 +5505,7 @@ pub fn completion(cx: &mut Context) {
5508 if items.is_empty() {
5507 if items.is_empty() {
5509− // editor.set_error("No completion available".to_string());
5508+ // editor.set_error("No completion available");
5512 let size = compositor.size();
5511 let size = compositor.size();
@@ -5787,8 +5786,7 @@ fn jump_backward(cx: &mut Context) {
5788fn save_selection(cx: &mut Context) {
5787fn save_selection(cx: &mut Context) {
5789 push_jump(cx.editor);
5788 push_jump(cx.editor);
5791− .set_status("Selection saved to jumplist".to_owned());
5789+ cx.editor.set_status("Selection saved to jumplist");
5794fn rotate_view(cx: &mut Context) {
5792fn rotate_view(cx: &mut Context) {
@@ -6161,7 +6159,7 @@ fn shell_keep_pipe(cx: &mut Context) {
6163 if ranges.is_empty() {
6161 if ranges.is_empty() {
6164− cx.editor.set_error("No selections remaining".to_string());
6162+ cx.editor.set_error("No selections remaining");
@@ -6247,7 +6245,7 @@ fn shell(cx: &mut Context, prompt: Cow<'static, str>, behavior: ShellBehavior) {
6249 if !success {
6247 if !success {
6250− cx.editor.set_error("Command failed".to_string());
6248+ cx.editor.set_error("Command failed");