Skip to content

Commit 8c34978

Browse files
committed
Panic in take_rx()
1 parent 9b2337d commit 8c34978

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

crates/ark/src/r_task.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,17 @@ impl TaskChannels {
5252
self.tx.clone()
5353
}
5454

55-
fn take_rx(&self) -> Option<Receiver<RTask>> {
55+
fn take_rx(&self) -> Receiver<RTask> {
5656
let mut rx = self.rx.lock().unwrap();
57-
rx.take()
57+
rx.take().expect("`take_rx()` can only be called once")
5858
}
5959
}
6060

6161
/// Returns receivers for both interrupt and idle tasks.
6262
/// Initializes the task channels if they haven't been initialized yet.
6363
/// Can only be called once (intended for `RMain` during init).
6464
pub(crate) fn take_receivers() -> (Receiver<RTask>, Receiver<RTask>) {
65-
(
66-
INTERRUPT_TASKS.take_rx().unwrap(),
67-
IDLE_TASKS.take_rx().unwrap(),
68-
)
65+
(INTERRUPT_TASKS.take_rx(), IDLE_TASKS.take_rx())
6966
}
7067

7168
pub enum RTask {

0 commit comments

Comments
 (0)