Skip to content

Commit

Permalink
clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wathenjiang committed Sep 28, 2023
1 parent d504e2d commit 3aaa758
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tokio/src/runtime/scheduler/multi_thread_alt/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ impl Shared {

pub(super) fn shutdown_core(&self, handle: &Handle, mut core: Box<Core>) {
// Start from a random inner list
let start = core.rand.fastrand_n(self.owned.segment_size as u32);
let start = core.rand.fastrand_n(self.owned.segment_size);
self.owned.close_and_shutdown_all(start as usize);

core.stats.submit(&self.worker_metrics[core.index]);
Expand Down
11 changes: 4 additions & 7 deletions tokio/src/runtime/task/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,20 +403,17 @@ impl Header {
// the safety requirements on `set_owner_id`.
unsafe {
self.owner_id.with(|ptr| match *ptr {
Some(num) => return NonZeroU32::new((num.get() & 0xFFFF_FFFF) as u32),
None => return None,
Some(num) => NonZeroU32::new((num.get() & 0xFFFF_FFFF) as u32),
None => None,
})
}
}

pub(super) fn get_segment_id(&self) -> Option<u32> {
// safety: If there are concurrent writes, then that write has violated
// the safety requirements on `set_segment_id`.
unsafe {
self.owner_id.with(|ptr| match *ptr {
Some(num) => return Some((num.get() >> 32) as u32),
None => return None,
})
unsafe {
self.owner_id.with(|ptr| (*ptr).map(|num| (num.get() >> 32) as u32))
}
}

Expand Down

0 comments on commit 3aaa758

Please sign in to comment.