Fix unused Result
warnings in helix-term.
This commit is contained in:
parent
efa3389b6a
commit
0b2d51cf5a
3 changed files with 12 additions and 7 deletions
|
@ -447,17 +447,20 @@ impl Application {
|
|||
// Exit the alternate screen and disable raw mode before panicking
|
||||
let hook = std::panic::take_hook();
|
||||
std::panic::set_hook(Box::new(move |info| {
|
||||
execute!(std::io::stdout(), terminal::LeaveAlternateScreen);
|
||||
terminal::disable_raw_mode();
|
||||
// We can't handle errors properly inside this closure. And it's
|
||||
// probably not a good idea to `unwrap()` inside a panic handler.
|
||||
// So we just ignore the `Result`s.
|
||||
let _ = execute!(std::io::stdout(), terminal::LeaveAlternateScreen);
|
||||
let _ = terminal::disable_raw_mode();
|
||||
hook(info);
|
||||
}));
|
||||
|
||||
self.event_loop().await;
|
||||
|
||||
self.editor.close_language_servers(None).await;
|
||||
self.editor.close_language_servers(None).await?;
|
||||
|
||||
// reset cursor shape
|
||||
write!(stdout, "\x1B[2 q");
|
||||
write!(stdout, "\x1B[2 q")?;
|
||||
|
||||
execute!(stdout, terminal::LeaveAlternateScreen)?;
|
||||
|
||||
|
|
|
@ -1135,7 +1135,7 @@ mod cmd {
|
|||
match args.get(0) {
|
||||
Some(path) => {
|
||||
// TODO: handle error
|
||||
cx.editor.open(path.into(), Action::Replace);
|
||||
let _ = cx.editor.open(path.into(), Action::Replace);
|
||||
}
|
||||
None => {
|
||||
cx.editor.set_error("wrong argument count".to_string());
|
||||
|
@ -1367,7 +1367,9 @@ mod cmd {
|
|||
errors.push_str("cannot write a buffer without a filename\n");
|
||||
continue;
|
||||
}
|
||||
helix_lsp::block_on(tokio::spawn(doc.save()));
|
||||
|
||||
// TODO: handle error.
|
||||
let _ = helix_lsp::block_on(tokio::spawn(doc.save()));
|
||||
}
|
||||
editor.set_error(errors);
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ impl Compositor {
|
|||
let (pos, kind) = self.cursor(area, cx.editor);
|
||||
let pos = pos.map(|pos| (pos.col as u16, pos.row as u16));
|
||||
|
||||
self.terminal.draw(pos, kind);
|
||||
self.terminal.draw(pos, kind).unwrap();
|
||||
}
|
||||
|
||||
pub fn cursor(&self, area: Rect, editor: &Editor) -> (Option<Position>, CursorKind) {
|
||||
|
|
Loading…
Add table
Reference in a new issue