Skip to content

Commit 240893e

Browse files
committed
make clippy happy
1 parent e12eb33 commit 240893e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/executor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ pub struct Ticker {
192192
///
193193
/// States a ticker can be in:
194194
/// 1) Woken.
195-
/// 2a) Sleeping and unnotified.
196-
/// 2b) Sleeping and notified.
195+
/// 2a) Sleeping and unnotified.
196+
/// 2b) Sleeping and notified.
197197
sleeping: AtomicUsize,
198198

199199
/// Bumped every time a task is run.
@@ -270,7 +270,7 @@ impl Ticker {
270270
// Bump the ticker.
271271
let ticks = self.ticks.fetch_add(1, Ordering::SeqCst);
272272
// Steal tasks from the global queue to ensure fair task scheduling.
273-
if ticks % 64 == 0 {
273+
if ticks.is_multiple_of(64) {
274274
local_queue
275275
.local
276276
.steal(self.state.queue.len(), || self.state.queue.pop().ok());
@@ -366,7 +366,7 @@ impl<T> Local<T> {
366366
/// Steals some items from another into local.
367367
fn steal(&self, length: usize, f: impl Fn() -> Option<T>) {
368368
// Half of `src`'s length rounded up.
369-
let mut count = (length + 1) / 2;
369+
let mut count = length.div_ceil(2);
370370
if count > 0 {
371371
// Don't steal more than fits into local.
372372
count = count.min(self.capacity() - self.len());

src/queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<T> Queue<T> {
7878
}
7979

8080
pub fn len(&self) -> usize {
81-
let inner = self.inner.write().unwrap();
81+
let inner = self.inner.read().unwrap();
8282
inner.length
8383
}
8484

0 commit comments

Comments
 (0)