dap: Remove some unwraps
This commit is contained in:
parent
ffc89e483b
commit
573cb39926
2 changed files with 18 additions and 15 deletions
helix-term/src
|
@ -388,18 +388,20 @@ impl Application {
|
|||
}
|
||||
Event::Breakpoint(events::Breakpoint { reason, breakpoint }) => match &reason[..] {
|
||||
"new" => {
|
||||
self.editor
|
||||
.breakpoints
|
||||
.entry(breakpoint.source.unwrap().path.unwrap()) // TODO: no unwraps
|
||||
.or_default()
|
||||
.push(Breakpoint {
|
||||
id: breakpoint.id,
|
||||
verified: breakpoint.verified,
|
||||
message: breakpoint.message,
|
||||
line: breakpoint.line.unwrap().saturating_sub(1), // TODO: no unwrap
|
||||
column: breakpoint.column,
|
||||
..Default::default()
|
||||
});
|
||||
if let Some(source) = breakpoint.source {
|
||||
self.editor
|
||||
.breakpoints
|
||||
.entry(source.path.unwrap()) // TODO: no unwraps
|
||||
.or_default()
|
||||
.push(Breakpoint {
|
||||
id: breakpoint.id,
|
||||
verified: breakpoint.verified,
|
||||
message: breakpoint.message,
|
||||
line: breakpoint.line.unwrap().saturating_sub(1), // TODO: no unwrap
|
||||
column: breakpoint.column,
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
}
|
||||
"changed" => {
|
||||
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;
|
||||
};
|
||||
|
||||
editor
|
||||
.open(path, helix_view::editor::Action::Replace)
|
||||
.unwrap(); // TODO: there should be no unwrapping!
|
||||
if let Err(e) = editor.open(path, helix_view::editor::Action::Replace) {
|
||||
editor.set_error(format!("Unable to jump to stack frame: {}", e));
|
||||
return;
|
||||
}
|
||||
|
||||
let (view, doc) = current!(editor);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue