From c885d1a7e7ddabc01aec6439ef5f3f241f4ffc1e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bennet=20Ble=C3=9Fmann?= Date: Thu, 31 Jul 2025 21:41:23 +0200 Subject: [PATCH] collaps els-if / if-if --- src/machine/heap.rs | 6 ++---- src/machine/machine_state_impl.rs | 10 ++++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/machine/heap.rs b/src/machine/heap.rs index 66e511f5..0aad650a 100644 --- a/src/machine/heap.rs +++ b/src/machine/heap.rs @@ -745,10 +745,8 @@ impl Heap { // the heap to a pre-allocated resource error pub(crate) fn push_cell(&mut self, cell: HeapCellValue) -> Result<(), usize> { unsafe { - if self.inner.byte_len == self.inner.byte_cap { - if !self.grow() { - return Err(self.resource_error_offset()); - } + if self.inner.byte_len == self.inner.byte_cap && !self.grow() { + return Err(self.resource_error_offset()); } // SAFETY: diff --git a/src/machine/machine_state_impl.rs b/src/machine/machine_state_impl.rs index f663656c..3f14253d 100644 --- a/src/machine/machine_state_impl.rs +++ b/src/machine/machine_state_impl.rs @@ -847,13 +847,11 @@ impl MachineState { if let Some(c) = char_iter.next() { if n == 1 { self.unify_char(c, a3); + } else if char_iter.next().is_some() { + unify_fn!(*self, pstr_loc_as_cell!(pstr_loc + c.len_utf8()), a3); } else { - if char_iter.next().is_some() { - unify_fn!(*self, pstr_loc_as_cell!(pstr_loc + c.len_utf8()), a3); - } else { - let tail_idx = Heap::pstr_tail_idx(pstr_loc + c.len_utf8()); - unify_fn!(*self, self.heap[tail_idx], a3); - } + let tail_idx = Heap::pstr_tail_idx(pstr_loc + c.len_utf8()); + unify_fn!(*self, self.heap[tail_idx], a3); } } else { unreachable!() -- 2.54.0