Skip to content

fix(rewrite): CycleInterval::len to safe pattern and correct bounds#2809

Open
jrootcache wants to merge 1 commit into0xMiden:nextfrom
jrootcache:fix/cycleinterval-len
Open

fix(rewrite): CycleInterval::len to safe pattern and correct bounds#2809
jrootcache wants to merge 1 commit into0xMiden:nextfrom
jrootcache:fix/cycleinterval-len

Conversation

@jrootcache
Copy link
Copy Markdown

Problem

The CycleInterval::len() method used invalid Rust syntax to conditionally extract start and end, potentially causing compilation issues and incorrect interval length computation.

Fix

Refactor CycleInterval::len() to a simple, idiomatic match over (start, end) and compute length only when both bounds exist and end >= start.

Why this is safe

  • Minimal change confined to a single method with no API changes.
  • Preserves existing behavior for valid intervals and gracefully returns 0 when bounds are missing or inverted.
  • Avoids unstable or illegal syntax, ensuring compatibility with stable Rust compilers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant