Skip to content

Commit e80c4e0

Browse files
committed
fmt
1 parent e86d9e7 commit e80c4e0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/alloc/discrete_alloc.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,15 @@ impl MachineAlloc {
114114

115115
/// SAFETY: The allocator must have been `enable()`d already and
116116
/// the `layout` must be valid.
117-
unsafe fn alloc_inner(&mut self, layout: Layout, sys_allocator: unsafe fn(Layout) -> *mut u8) -> *mut u8 {
117+
unsafe fn alloc_inner(
118+
&mut self,
119+
layout: Layout,
120+
sys_allocator: unsafe fn(Layout) -> *mut u8,
121+
) -> *mut u8 {
118122
let (size, align) = MachineAlloc::normalized_layout(layout);
119123

120124
if align > self.page_size || size > self.page_size {
121-
unsafe {
122-
self.alloc_multi_page(layout, sys_allocator)
123-
}
125+
unsafe { self.alloc_multi_page(layout, sys_allocator) }
124126
} else {
125127
for (page, pinfo) in std::iter::zip(&mut self.pages, &mut self.allocated) {
126128
for idx in (0..self.page_size).step_by(align) {
@@ -150,7 +152,11 @@ impl MachineAlloc {
150152

151153
/// SAFETY: Same as `alloc_inner()` with the added requirement that `layout`
152154
/// must ask for a size larger than the host pagesize.
153-
unsafe fn alloc_multi_page(&mut self, layout: Layout, sys_allocator: unsafe fn(Layout) -> *mut u8) -> *mut u8 {
155+
unsafe fn alloc_multi_page(
156+
&mut self,
157+
layout: Layout,
158+
sys_allocator: unsafe fn(Layout) -> *mut u8,
159+
) -> *mut u8 {
154160
let ret = unsafe { sys_allocator(layout) };
155161
self.huge_allocs.push((ret, layout.size()));
156162
ret

0 commit comments

Comments
 (0)