From 04230c97f7b6d43016baae64841e87d082b3f72e Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Mon, 10 Jan 2022 16:39:32 -0800 Subject: [PATCH] fmt --- tokio/src/runtime/queue.rs | 7 ++++++- tokio/src/runtime/stats/mock.rs | 3 +-- tokio/src/runtime/stats/stats.rs | 4 +++- tokio/src/runtime/thread_pool/worker.rs | 16 ++++++++++------ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/tokio/src/runtime/queue.rs b/tokio/src/runtime/queue.rs index f75e672c5eb..63049483928 100644 --- a/tokio/src/runtime/queue.rs +++ b/tokio/src/runtime/queue.rs @@ -102,7 +102,12 @@ impl Local { } /// Pushes a task to the back of the local queue, skipping the LIFO slot. - pub(super) fn push_back(&mut self, mut task: task::Notified, inject: &Inject, stats: &mut WorkerStatsBatcher) { + pub(super) fn push_back( + &mut self, + mut task: task::Notified, + inject: &Inject, + stats: &mut WorkerStatsBatcher, + ) { let tail = loop { let head = self.inner.head.load(Acquire); let (steal, real) = unpack(head); diff --git a/tokio/src/runtime/stats/mock.rs b/tokio/src/runtime/stats/mock.rs index a51e7d298d2..1bc1e35ab94 100644 --- a/tokio/src/runtime/stats/mock.rs +++ b/tokio/src/runtime/stats/mock.rs @@ -8,8 +8,7 @@ impl RuntimeStats { } /// Increment the number of tasks scheduled externally - pub(crate) fn inc_remote_schedule_count(&self) { - } + pub(crate) fn inc_remote_schedule_count(&self) {} pub(crate) fn worker(&self, _index: usize) -> &WorkerStats { &WorkerStats {} diff --git a/tokio/src/runtime/stats/stats.rs b/tokio/src/runtime/stats/stats.rs index aecf51dde52..fdb012e72b7 100644 --- a/tokio/src/runtime/stats/stats.rs +++ b/tokio/src/runtime/stats/stats.rs @@ -208,7 +208,9 @@ impl WorkerStatsBatcher { .busy_duration_total .store(self.busy_duration_total, Relaxed); - worker.local_schedule_count.store(self.local_schedule_count, Relaxed); + worker + .local_schedule_count + .store(self.local_schedule_count, Relaxed); worker.overflow_count.store(self.overflow_count, Relaxed); } diff --git a/tokio/src/runtime/thread_pool/worker.rs b/tokio/src/runtime/thread_pool/worker.rs index f4ddb654a15..b1da35c71e3 100644 --- a/tokio/src/runtime/thread_pool/worker.rs +++ b/tokio/src/runtime/thread_pool/worker.rs @@ -445,7 +445,8 @@ impl Context { } else { // Not enough budget left to run the LIFO task, push it to // the back of the queue and return. - core.run_queue.push_back(task, self.worker.inject(), &mut core.stats); + core.run_queue + .push_back(task, self.worker.inject(), &mut core.stats); return Ok(core); } } @@ -558,9 +559,10 @@ impl Core { let target = &worker.shared.remotes[i]; let target_stats = worker.shared.stats.worker(i); - if let Some(task) = target - .steal - .steal_into(&mut self.run_queue, &mut self.stats, target_stats) + if let Some(task) = + target + .steal + .steal_into(&mut self.run_queue, &mut self.stats, target_stats) { return Some(task); } @@ -732,7 +734,8 @@ impl Shared { // tasks to be executed. If **not** a yield, then there is more // flexibility and the task may go to the front of the queue. let should_notify = if is_yield { - core.run_queue.push_back(task, &self.inject, &mut core.stats); + core.run_queue + .push_back(task, &self.inject, &mut core.stats); true } else { // Push to the LIFO slot @@ -740,7 +743,8 @@ impl Shared { let ret = prev.is_some(); if let Some(prev) = prev { - core.run_queue.push_back(prev, &self.inject, &mut core.stats); + core.run_queue + .push_back(prev, &self.inject, &mut core.stats); } core.lifo_slot = Some(task);