Skip to content

Commit 9d23b42

Browse files
committed
Editing do_alloc for reducing LLVM IR
1 parent 3dbcdcc commit 9d23b42

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/raw/alloc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ mod inner {
88

99
#[allow(clippy::map_err_ignore)]
1010
pub fn do_alloc<A: Allocator>(alloc: &A, layout: Layout) -> Result<NonNull<u8>, ()> {
11-
alloc
12-
.allocate(layout)
13-
.map(|ptr| ptr.as_non_null_ptr())
14-
.map_err(|_| ())
11+
match alloc.allocate(layout) {
12+
Ok(ptr) => Ok(ptr.as_non_null_ptr()),
13+
Err(_) => Err(()),
14+
}
1515
}
1616

1717
#[cfg(feature = "bumpalo")]

0 commit comments

Comments
 (0)