Skip to content

Commit 83d7e35

Browse files
committed
fix clippy
1 parent a2690f7 commit 83d7e35

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

core/src/common/ordered_work_steal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ impl<'l, T: Debug> OrderedLocalQueue<'l, T> {
347347
/// ```
348348
pub fn pop(&self) -> Option<T> {
349349
//每从本地弹出61次,就从全局队列弹出
350-
if self.tick() % 61 == 0 {
350+
if self.tick().is_multiple_of(61) {
351351
if let Some(val) = self.shared.pop() {
352352
return Some(val);
353353
}

core/src/common/work_steal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ impl<'l, T: Debug> LocalQueue<'l, T> {
278278
/// ```
279279
pub fn pop(&self) -> Option<T> {
280280
//每从本地弹出61次,就从全局队列弹出
281-
if self.tick() % 61 == 0 {
281+
if self.tick().is_multiple_of(61) {
282282
if let Some(val) = self.shared.pop() {
283283
return Some(val);
284284
}

core/src/coroutine/korosensei.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'c, Param, Yield, Return> Coroutine<'c, Param, Yield, Return> {
5757
any(target_os = "linux", target_os = "android"),
5858
target_arch = "x86",
5959
))] {
60-
let sp = u64::from(std::mem::transmute::<_, std::ffi::c_uint>(context.uc_mcontext.gregs[usize::try_from(libc::REG_ESP).expect("overflow")]));
60+
let sp = u64::from(std::ffi::c_uint::from_ne_bytes(context.uc_mcontext.gregs[usize::try_from(libc::REG_ESP).expect("overflow")].to_ne_bytes()));
6161
} else if #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] {
6262
let sp = u64::try_from((*context.uc_mcontext).__ss.__rsp).expect("overflow");
6363
} else if #[cfg(all(
@@ -108,11 +108,11 @@ impl<'c, Param, Yield, Return> Coroutine<'c, Param, Yield, Return> {
108108
target_arch = "x86",
109109
))] {
110110
let TrapHandlerRegs { eip, esp, ebp, ecx, edx } = regs;
111-
context.uc_mcontext.gregs[usize::try_from(libc::REG_EIP).expect("overflow")] = std::mem::transmute(eip);
112-
context.uc_mcontext.gregs[usize::try_from(libc::REG_ESP).expect("overflow")] = std::mem::transmute(esp);
113-
context.uc_mcontext.gregs[usize::try_from(libc::REG_EBP).expect("overflow")] = std::mem::transmute(ebp);
114-
context.uc_mcontext.gregs[usize::try_from(libc::REG_ECX).expect("overflow")] = std::mem::transmute(ecx);
115-
context.uc_mcontext.gregs[usize::try_from(libc::REG_EDX).expect("overflow")] = std::mem::transmute(edx);
111+
context.uc_mcontext.gregs[usize::try_from(libc::REG_EIP).expect("overflow")] = i32::from_ne_bytes(eip.to_ne_bytes());
112+
context.uc_mcontext.gregs[usize::try_from(libc::REG_ESP).expect("overflow")] = i32::from_ne_bytes(esp.to_ne_bytes());
113+
context.uc_mcontext.gregs[usize::try_from(libc::REG_EBP).expect("overflow")] = i32::from_ne_bytes(ebp.to_ne_bytes());
114+
context.uc_mcontext.gregs[usize::try_from(libc::REG_ECX).expect("overflow")] = i32::from_ne_bytes(ecx.to_ne_bytes());
115+
context.uc_mcontext.gregs[usize::try_from(libc::REG_EDX).expect("overflow")] = i32::from_ne_bytes(edx.to_ne_bytes());
116116
} else if #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] {
117117
let TrapHandlerRegs { rip, rsp, rbp, rdi, rsi } = regs;
118118
(*context.uc_mcontext).__ss.__rip = rip;

0 commit comments

Comments
 (0)