chore: refactor the `switch` function for extra clarity
- Remove the idle context from the iterator so there's no need for a skipping logic with a mutable bool;
- Check whether switching to the idle context is a valid option after consuming the entire iterator and not finding a valid context to switch to;
- Decrease one indentation level from the code block that does the
switch by using the
let Some(foo) = bar else { ... };
syntax; - Replace
ContextRef::upgrade
byContextRef::get_lock
, which just returns a reference to the wrapped data (&Arc<_>
). No need forOption
+filter_map
; -
update_runnable
doesn't need to beunsafe
.
Edited by Arthur Paulino