Skip to content

Commit c30ac05

Browse files
committed
fix clippy
1 parent c4fb904 commit c30ac05

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

core/src/coroutine/korosensei.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use crate::{catch, warn};
77
use corosensei::stack::{DefaultStack, Stack};
88
use corosensei::trap::TrapHandlerRegs;
99
use corosensei::CoroutineResult;
10+
#[cfg(all(any(target_os = "linux", target_os = "android"), target_arch = "x86"))]
11+
use num_conv::CastUnsigned;
1012
use std::cell::{Cell, RefCell, UnsafeCell};
1113
use std::collections::VecDeque;
1214
use std::ffi::c_longlong;
@@ -57,9 +59,7 @@ impl<'c, Param, Yield, Return> Coroutine<'c, Param, Yield, Return> {
5759
any(target_os = "linux", target_os = "android"),
5860
target_arch = "x86",
5961
))] {
60-
let sp = context.uc_mcontext.gregs[usize::try_from(libc::REG_ESP)
61-
.unwrap_or_else(|_| panic!("{} overflow", libc::REG_ESP))];
62-
let sp = sp.try_into().unwrap_or_else(|_| panic!("sp {} overflow", sp));
62+
let sp = u64::from(std::ffi::c_uint::cast_unsigned(context.uc_mcontext.gregs[usize::try_from(libc::REG_ESP).expect("overflow")]));
6363
} else if #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] {
6464
let sp = u64::try_from((*context.uc_mcontext).__ss.__rsp).expect("overflow");
6565
} else if #[cfg(all(

0 commit comments

Comments
 (0)