Skip to content

Commit

Permalink
ref
Browse files Browse the repository at this point in the history
  • Loading branch information
tompro committed Feb 24, 2024
1 parent 31009e5 commit d451676
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions src/kernel/src/signal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,12 @@ impl Iterator for SignalIter {
type Item = Signal;

fn next(&mut self) -> Option<Self::Item> {
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<usize>) {
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/src/signal/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit d451676

Please sign in to comment.