diff options
author | Blaž Hrastnik | 2021-12-08 01:21:58 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-12-09 01:55:32 +0000 |
commit | 60c86eff898ccaa0688fb688a056b267fe832002 (patch) | |
tree | 78b29dd66047fe14480e422e218ad65f44447ace /helix-term/src/commands | |
parent | d8351d35abf0e9c6bad8dbe1f03e9b0fd0a40d72 (diff) |
dap: Simplify a few more statements that could use the debugger macro
Diffstat (limited to 'helix-term/src/commands')
-rw-r--r-- | helix-term/src/commands/dap.rs | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs index 300e31fa..b994f0f7 100644 --- a/helix-term/src/commands/dap.rs +++ b/helix-term/src/commands/dap.rs @@ -124,10 +124,7 @@ fn thread_picker( callback_fn(editor, &threads[0]); return; } - let debugger = match &mut editor.debugger { - Some(debugger) => debugger, - None => return, - }; + let debugger = debugger!(editor); let thread_states = debugger.thread_states.clone(); let picker = FilePicker::new( @@ -535,10 +532,7 @@ pub fn dap_continue(cx: &mut Context) { pub fn dap_pause(cx: &mut Context) { thread_picker(cx, |editor, thread| { - let debugger = match &mut editor.debugger { - Some(debugger) => debugger, - None => return, - }; + let debugger = debugger!(editor); let request = debugger.pause(thread.id); // NOTE: we don't need to set active thread id here because DAP will emit a "stopped" event if let Err(e) = block_on(request) { @@ -670,7 +664,7 @@ pub fn dap_enable_exceptions(cx: &mut Context) { pub fn dap_disable_exceptions(cx: &mut Context) { let debugger = debugger!(cx.editor); - if let Err(e) = block_on(debugger.set_exception_breakpoints(vec![])) { + if let Err(e) = block_on(debugger.set_exception_breakpoints(Vec::new())) { cx.editor .set_error(format!("Failed to set up exception breakpoints: {}", e)); } @@ -787,10 +781,7 @@ pub fn dap_switch_stack_frame(cx: &mut Context) { frames, |frame| frame.name.clone().into(), // TODO: include thread_states in the label move |cx, frame, _action| { - let debugger = match &mut cx.editor.debugger { - Some(debugger) => debugger, - None => return, - }; + let debugger = debugger!(cx.editor); // TODO: this should be simpler to find let pos = debugger.stack_frames[&thread_id] .iter() |