From d45167608a1fc58bf5690c45019a7d95a449642a Mon Sep 17 00:00:00 2001 From: tompro Date: Sat, 24 Feb 2024 14:10:49 +0100 Subject: [PATCH] ref --- src/kernel/src/signal/mod.rs | 12 +++++------- src/kernel/src/signal/set.rs | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/kernel/src/signal/mod.rs b/src/kernel/src/signal/mod.rs index 25a455576..805962e66 100644 --- a/src/kernel/src/signal/mod.rs +++ b/src/kernel/src/signal/mod.rs @@ -108,14 +108,12 @@ impl Iterator for SignalIter { type Item = Signal; fn next(&mut self) -> Option { - if self.current > SIG_MAXSIG { - return None; + if let Some(sig) = Signal::new(self.current) { + self.current += 1; + Some(sig) + } else { + None } - - let sig = Signal::new(self.current); - self.current += 1; - - sig } fn size_hint(&self) -> (usize, Option) { diff --git a/src/kernel/src/signal/set.rs b/src/kernel/src/signal/set.rs index e9bef9cb8..0d52a2266 100644 --- a/src/kernel/src/signal/set.rs +++ b/src/kernel/src/signal/set.rs @@ -33,7 +33,7 @@ impl SignalSet { /// An implementation of `_SIG_WORD`. fn word(s: Signal) -> usize { // This is safe because `Signal` is guaranteed to be non-negative. - unsafe { (Self::idx(s) >> 5).try_into().unwrap_unchecked() } + unsafe { (Self::idx(s) >> 5).try_into().unwrap() } } /// An implementation of `_SIG_BIT`.