Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
DelSkayn committed Feb 16, 2024
1 parent ab066c3 commit 3bd9f91
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions core/src/allocator/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ mod test {
struct TestAllocator;

unsafe impl Allocator for TestAllocator {
unsafe fn alloc(&mut self, size: usize) -> crate::allocator::RawMemPtr {
let res = RustAllocator.alloc(size);
ALLOC_SIZE.fetch_add(RustAllocator::usable_size(res), Ordering::AcqRel);
res
fn alloc(&mut self, size: usize) -> crate::allocator::RawMemPtr {
unsafe {
let res = RustAllocator.alloc(size);
ALLOC_SIZE.fetch_add(RustAllocator::usable_size(res), Ordering::AcqRel);
res
}
}

unsafe fn dealloc(&mut self, ptr: crate::allocator::RawMemPtr) {
Expand Down
5 changes: 3 additions & 2 deletions core/src/runtime/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,12 @@ impl AsyncRuntime {
lock.drop_pending();

loop {
match lock.runtime.execute_pending_job().map_err(|e| {
let pending = lock.runtime.execute_pending_job().map_err(|e| {
let ptr = NonNull::new(e)
.expect("executing pending job returned a null context on error");
AsyncJobException(unsafe { AsyncContext::from_raw(ptr, self.clone()) })
}) {
});
match pending {
Err(e) => {
// SAFETY: Runtime is already locked so creating a context is safe.
let ctx = unsafe { Ctx::from_ptr(e.0 .0.ctx.as_ptr()) };
Expand Down
5 changes: 3 additions & 2 deletions core/src/runtime/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,11 @@ impl RawRuntime {
_rt: *mut qjs::JSRuntime,
opaque: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int {
let should_interrupt = match panic::catch_unwind(move || {
let catch_unwind = panic::catch_unwind(move || {
let opaque = &mut *(opaque as *mut Opaque);
opaque.interrupt_handler.as_mut().expect("handler is set")()
}) {
});
let should_interrupt = match catch_unwind {
Ok(should_interrupt) => should_interrupt,
Err(panic) => {
let opaque = &mut *(opaque as *mut Opaque);
Expand Down

0 comments on commit 3bd9f91

Please sign in to comment.