Skip to content

Commit

Permalink
Bump dependencies, clippy suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fmckeogh committed Jan 26, 2024
1 parent a51e890 commit b437bd3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ version = "0.9.8"
optional = true

[dev-dependencies]
criterion = "0.3"
ctor = "0.1.23"
criterion = "0.5.1"
ctor = "0.2.6"
rand = "0.8.5"
rand_chacha = "0.3.1"

Expand Down
5 changes: 1 addition & 4 deletions benches/memory_allocator_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use alloc::alloc::GlobalAlloc;
use alloc::alloc::Layout;
use buddy_system_allocator::LockedHeap;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use rand::{Rng, SeedableRng};

const SMALL_SIZE: usize = 8;
const LARGE_SIZE: usize = 1024 * 1024; // 1M
Expand Down Expand Up @@ -42,10 +43,6 @@ pub fn large_alloc<const ORDER: usize>(heap: &LockedHeap<ORDER>) {
pub fn mutil_thread_random_size<const ORDER: usize>(heap: &'static LockedHeap<ORDER>) {
const THREAD_SIZE: usize = 10;

use rand::prelude::*;
use rand::{Rng, SeedableRng};
use rand_chacha::ChaCha8Rng;

let mut threads = Vec::with_capacity(THREAD_SIZE);
let alloc = Arc::new(heap);
for i in 0..THREAD_SIZE {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ unsafe impl<const ORDER: usize> GlobalAlloc for LockedHeap<ORDER> {
.lock()
.alloc(layout)
.ok()
.map_or(0 as *mut u8, |allocation| allocation.as_ptr())
.map_or(core::ptr::null_mut(), |allocation| allocation.as_ptr())
}

unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
Expand Down Expand Up @@ -328,7 +328,7 @@ unsafe impl<const ORDER: usize> GlobalAlloc for LockedHeapWithRescue<ORDER> {
inner
.alloc(layout)
.ok()
.map_or(0 as *mut u8, |allocation| allocation.as_ptr())
.map_or(core::ptr::null_mut(), |allocation| allocation.as_ptr())
}
}
}
Expand Down

0 comments on commit b437bd3

Please sign in to comment.