diff options
author | Blaž Hrastnik | 2021-11-07 12:37:00 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-11-07 12:37:00 +0000 |
commit | 9963a5614d09bb0677464ad4cecc41d94cf2d7c4 (patch) | |
tree | 861f97c95a3c2a75cc2f63839b3e812b85828139 /helix-term | |
parent | 65868081fcc54aa4ce2ede3b95bb9800534f41f8 (diff) |
dap: Minor simplifications
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/commands/dap.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs index d9f0ba8f..51b5d390 100644 --- a/helix-term/src/commands/dap.rs +++ b/helix-term/src/commands/dap.rs @@ -123,7 +123,8 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa thread.name, thread_states .get(&thread.id) - .unwrap_or(&"unknown".to_owned()) + .map(|state| state.as_str()) + .unwrap_or("unknown") ) .into() }, @@ -173,9 +174,7 @@ pub fn dap_start_impl( { Some(c) => c, None => { - editor.set_error( - "Can't start debug: no debug adapter available for language".to_string(), - ); + editor.set_error("No debug adapter available for language".to_string()); return; } }; @@ -215,7 +214,7 @@ pub fn dap_start_impl( let start_config = match start_config { Some(c) => c, None => { - editor.set_error("Can't start debug: no debug config with given name".to_string()); + editor.set_error("No debug config with given name".to_string()); return; } }; @@ -288,7 +287,7 @@ pub fn dap_start_impl( pub fn dap_launch(cx: &mut Context) { if cx.editor.debugger.is_some() { cx.editor - .set_error("Can't start debug: debugger is running".to_string()); + .set_error("Debugger is already running".to_string()); return; } @@ -300,9 +299,8 @@ pub fn dap_launch(cx: &mut Context) { { Some(c) => c, None => { - cx.editor.set_error( - "Can't start debug: no debug adapter available for language".to_string(), - ); + cx.editor + .set_error("No debug adapter available for language".to_string()); return; } }; @@ -658,7 +656,7 @@ pub fn dap_edit_condition(cx: &mut Context) { return; } - let (_, doc) = current!(cx.editor); + let doc = doc!(cx.editor); let path = match doc.path() { Some(path) => path, None => { @@ -737,7 +735,7 @@ pub fn dap_edit_log(cx: &mut Context) { return; } - let (_, doc) = current!(cx.editor); + let doc = doc!(cx.editor); let path = match doc.path() { Some(path) => path, None => { |