Skip to content

Commit

Permalink
refactor: remove unnecessary unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
llenotre committed Oct 7, 2024
1 parent 92bbab7 commit 35a6717
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ unsafe fn __realloc(
use core::cmp::Ordering;
use rust_alloc::alloc::{Allocator, Global};
match new_layout.size().cmp(&old_layout.size()) {
Ordering::Less => unsafe { Global.shrink(ptr, old_layout, new_layout) },
Ordering::Greater => unsafe { Global.grow(ptr, old_layout, new_layout) },
Ordering::Less => Global.shrink(ptr, old_layout, new_layout),
Ordering::Greater => Global.grow(ptr, old_layout, new_layout),
Ordering::Equal => Ok(NonNull::slice_from_raw_parts(
NonNull::dangling(),
new_layout.size(),
Expand All @@ -126,7 +126,7 @@ unsafe fn __realloc(
#[no_mangle]
unsafe fn __dealloc(ptr: NonNull<u8>, layout: Layout) {
use rust_alloc::alloc::{Allocator, Global};
unsafe { Global.deallocate(ptr, layout) }
Global.deallocate(ptr, layout);
}

/// Aligns a pointer.
Expand Down

0 comments on commit 35a6717

Please sign in to comment.