Skip to content

Commit 8a792a1

Browse files
authored
improve borrow_mut (#8344)
### Description avoid keeping the borrow too long ### Testing Instructions <!-- Give a quick description of steps to test your changes. -->
1 parent 008ef18 commit 8a792a1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

crates/turbo-tasks/src/manager.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -871,10 +871,12 @@ impl<B: Backend + 'static> TurboTasksApi for TurboTasks<B> {
871871

872872
fn notify_scheduled_tasks(&self) {
873873
let _ = CURRENT_TASK_STATE.try_with(|cell| {
874-
let CurrentTaskState {
875-
tasks_to_notify, ..
876-
} = &mut *cell.borrow_mut();
877-
let tasks = take(tasks_to_notify);
874+
let tasks = {
875+
let CurrentTaskState {
876+
tasks_to_notify, ..
877+
} = &mut *cell.borrow_mut();
878+
take(tasks_to_notify)
879+
};
878880
if tasks.is_empty() {
879881
return;
880882
}

0 commit comments

Comments
 (0)