From 09cf056d32375e2c1300292ac9e199f9edf46b5d Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Sun, 5 May 2024 03:08:05 -0700 Subject: [PATCH] fix: fix clippy issue with for loop that only ever inspects the first item --- src/event/source/unix/mio.rs | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/event/source/unix/mio.rs b/src/event/source/unix/mio.rs index f9d595af..8372a1dd 100644 --- a/src/event/source/unix/mio.rs +++ b/src/event/source/unix/mio.rs @@ -120,23 +120,18 @@ impl EventSource for UnixInternalEventSource { } } SIGNAL_TOKEN => { - for signal in self.signals.pending() { - match signal { - signal_hook::consts::SIGWINCH => { - // TODO Should we remove tput? - // - // This can take a really long time, because terminal::size can - // launch new process (tput) and then it parses its output. It's - // not a really long time from the absolute time point of view, but - // it's a really long time from the mio, async-std/tokio executor, ... - // point of view. - let new_size = crate::terminal::size()?; - return Ok(Some(InternalEvent::Event(Event::Resize( - new_size.0, new_size.1, - )))); - } - _ => unreachable!("Synchronize signal registration & handling"), - }; + if self.signals.pending().next() == Some(signal_hook::consts::SIGWINCH) { + // TODO Should we remove tput? + // + // This can take a really long time, because terminal::size can + // launch new process (tput) and then it parses its output. It's + // not a really long time from the absolute time point of view, but + // it's a really long time from the mio, async-std/tokio executor, ... + // point of view. + let new_size = crate::terminal::size()?; + return Ok(Some(InternalEvent::Event(Event::Resize( + new_size.0, new_size.1, + )))); } } #[cfg(feature = "event-stream")]