Skip to content

refactor: simplify for-loops with direct iteration#3279

Merged
bobzhang merged 1 commit intomainfrom
hongbo/refactor2
Mar 13, 2026
Merged

refactor: simplify for-loops with direct iteration#3279
bobzhang merged 1 commit intomainfrom
hongbo/refactor2

Conversation

@bobzhang
Copy link
Copy Markdown
Contributor

@bobzhang bobzhang commented Mar 13, 2026

Summary

  • Replace for i in 0..<arr.length() { let x = arr[i] ... } with for i, x in arr { ... } or for x in arr { ... } when the index is unused across 19 files
  • Convert a while-loop binary search in sparse_table.mbt to a functional for-loop with state variables
  • Net reduction of 20 lines

Test plan

  • moon check passes
  • moon fmt applied
  • Codex review confirms correct mechanical refactor with no semantic changes

🤖 Generated with Claude Code


Open with Devin

… for-loop

Replace `for i in 0..<arr.length() { let x = arr[i] ... }` with
`for i, x in arr { ... }` or `for x in arr { ... }` when the index
is unused. Also convert a while-loop binary search to a functional
for-loop with state variables.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@coveralls
Copy link
Copy Markdown
Collaborator

Pull Request Test Coverage Report for Build 2877

Details

  • 12 of 13 (92.31%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.002%) to 95.77%

Changes Missing Coverage Covered Lines Changed/Added Lines %
bytes/internal/regex_engine/symbol_map/sparse_table.mbt 4 5 80.0%
Totals Coverage Status
Change from base Build 2873: -0.002%
Covered Lines: 13742
Relevant Lines: 14349

💛 - Coveralls

@bobzhang bobzhang merged commit 9bf4457 into main Mar 13, 2026
14 checks passed
@bobzhang bobzhang deleted the hongbo/refactor2 branch March 13, 2026 14:11
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.

2 participants