dap: Remove some unwraps

pull/574/head
Blaž Hrastnik 3 years ago
parent ffc89e483b
commit 573cb39926

@ -388,18 +388,20 @@ impl Application {
} }
Event::Breakpoint(events::Breakpoint { reason, breakpoint }) => match &reason[..] { Event::Breakpoint(events::Breakpoint { reason, breakpoint }) => match &reason[..] {
"new" => { "new" => {
self.editor if let Some(source) = breakpoint.source {
.breakpoints self.editor
.entry(breakpoint.source.unwrap().path.unwrap()) // TODO: no unwraps .breakpoints
.or_default() .entry(source.path.unwrap()) // TODO: no unwraps
.push(Breakpoint { .or_default()
id: breakpoint.id, .push(Breakpoint {
verified: breakpoint.verified, id: breakpoint.id,
message: breakpoint.message, verified: breakpoint.verified,
line: breakpoint.line.unwrap().saturating_sub(1), // TODO: no unwrap message: breakpoint.message,
column: breakpoint.column, line: breakpoint.line.unwrap().saturating_sub(1), // TODO: no unwrap
..Default::default() column: breakpoint.column,
}); ..Default::default()
});
}
} }
"changed" => { "changed" => {
for breakpoints in self.editor.breakpoints.values_mut() { for breakpoints in self.editor.breakpoints.values_mut() {

@ -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