From adb6cd537628308a23fe6ea86f1c7b419c4d8c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 26 Oct 2021 18:02:36 +0900 Subject: [PATCH] Simplify handle_terminal_events signature --- helix-term/src/application.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index e8fbb7cc..075b9c35 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -213,7 +213,7 @@ impl Application { tokio::select! { biased; - event = reader.next() => { + Some(event) = reader.next() => { self.handle_terminal_events(event) } Some(signal) = self.signals.next() => { @@ -351,7 +351,7 @@ impl Application { } } - pub fn handle_terminal_events(&mut self, event: Option>) { + pub fn handle_terminal_events(&mut self, event: Result) { let mut cx = crate::compositor::Context { editor: &mut self.editor, jobs: &mut self.jobs, @@ -359,15 +359,14 @@ impl Application { }; // Handle key events let should_redraw = match event { - Some(Ok(Event::Resize(width, height))) => { + Ok(Event::Resize(width, height)) => { self.compositor.resize(width, height); self.compositor .handle_event(Event::Resize(width, height), &mut cx) } - Some(Ok(event)) => self.compositor.handle_event(event, &mut cx), - Some(Err(x)) => panic!("{}", x), - None => panic!(), + Ok(event) => self.compositor.handle_event(event, &mut cx), + Err(x) => panic!("{}", x), }; if should_redraw && !self.editor.should_close() {