Skip to content

Commit 9a135a0

Browse files
committed
chore(core): refactoring
1 parent 7a858cf commit 9a135a0

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

core/src/memory.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,9 @@ impl AllocationsContext {
422422
pages: WasmPagesAmount,
423423
charge_gas_for_grow: impl FnOnce(WasmPagesAmount) -> Result<(), ChargeError>,
424424
) -> Result<WasmPage, AllocError> {
425-
let heap = match self.heap {
426-
Some(heap) => heap,
427-
428-
// Empty heap means that all memory is static, then no pages can be allocated.
429-
// NOTE: returns an error even if `pages` == 0.
430-
None => return Err(AllocError::ProgramAllocOutOfBounds),
431-
};
425+
// Empty heap means that all memory is static, then no pages can be allocated.
426+
// NOTE: returns an error even if `pages` == 0.
427+
let heap = self.heap.ok_or(Err(AllocError::ProgramAllocOutOfBounds))?;
432428

433429
// If trying to allocate zero pages, then returns heap start page (legacy).
434430
if pages == WasmPage::from(0) {

0 commit comments

Comments
 (0)