dap: Remove some unwraps

imgbot
Blaž Hrastnik 3 years ago
parent ffc89e483b
commit 573cb39926

@ -388,9 +388,10 @@ impl Application {
} }
Event::Breakpoint(events::Breakpoint { reason, breakpoint }) => match &reason[..] { Event::Breakpoint(events::Breakpoint { reason, breakpoint }) => match &reason[..] {
"new" => { "new" => {
if let Some(source) = breakpoint.source {
self.editor self.editor
.breakpoints .breakpoints
.entry(breakpoint.source.unwrap().path.unwrap()) // TODO: no unwraps .entry(source.path.unwrap()) // TODO: no unwraps
.or_default() .or_default()
.push(Breakpoint { .push(Breakpoint {
id: breakpoint.id, id: breakpoint.id,
@ -401,6 +402,7 @@ impl Application {
..Default::default() ..Default::default()
}); });
} }
}
"changed" => { "changed" => {
for breakpoints in self.editor.breakpoints.values_mut() { for breakpoints in self.editor.breakpoints.values_mut() {
if let Some(i) = breakpoints.iter().position(|b| b.id == breakpoint.id) if let Some(i) = breakpoints.iter().position(|b| b.id == breakpoint.id)

@ -78,9 +78,10 @@ pub fn jump_to_stack_frame(editor: &mut Editor, frame: &helix_dap::StackFrame) {
return; return;
}; };
editor if let Err(e) = editor.open(path, helix_view::editor::Action::Replace) {
.open(path, helix_view::editor::Action::Replace) editor.set_error(format!("Unable to jump to stack frame: {}", e));
.unwrap(); // TODO: there should be no unwrapping! return;
}
let (view, doc) = current!(editor); let (view, doc) = current!(editor);

Loading…
Cancel
Save