From 5d4268e16bd32d98e4efe44e475ceabb711192e1 Mon Sep 17 00:00:00 2001 From: lavidaloca26 Date: Wed, 22 Apr 2026 14:00:35 +0300 Subject: [PATCH] fix: rewrite CycleInterval::len to safe pattern and correct bounds handling --- crates/miden-tx/src/host/tx_progress.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/miden-tx/src/host/tx_progress.rs b/crates/miden-tx/src/host/tx_progress.rs index fc8be54d65..9e8d33f2f2 100644 --- a/crates/miden-tx/src/host/tx_progress.rs +++ b/crates/miden-tx/src/host/tx_progress.rs @@ -201,13 +201,10 @@ impl CycleInterval { /// Calculate the length of the interval pub fn len(&self) -> usize { - if let Some(start) = self.start - && let Some(end) = self.end - && end >= start - { - return end - start; + // Safe, straightforward computation without relying on unstable syntax + match (self.start, self.end) { + (Some(start), Some(end)) if end >= start => end - start, + _ => 0, } - - 0 } }