Skip to content

Commit 2b4330f

Browse files
bobzhangclaude
andcommitted
refactor(immut): if-is for None=>() match in HAMT each helpers
Both `immut/hashset/HAMT.mbt` and `immut/hashmap/HAMT.mbt` had a noop-on-empty match in their iteration helper: ```moonbit match self.0 { None => () Some(node) => go(node) } ``` Replaced with the equivalent direct form: ```moonbit if self.0 is Some(node) { go(node) } ``` Both files share the exact same shape so bundled. Semantics-preserving: full `moon test` (6425/6425) passes and `moon info` produces no `.mbti` change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 03bc394 commit 2b4330f

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

immut/hashmap/HAMT.mbt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,8 @@ pub fn[K, V] HashMap::each(
610610
}
611611
}
612612

613-
match self.0 {
614-
None => ()
615-
Some(node) => go(node)
613+
if self.0 is Some(node) {
614+
go(node)
616615
}
617616
}
618617

immut/hashset/HAMT.mbt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,8 @@ pub fn[A] HashSet::each(
341341
}
342342
}
343343

344-
match self.0 {
345-
None => ()
346-
Some(node) => go(node)
344+
if self.0 is Some(node) {
345+
go(node)
347346
}
348347
}
349348

0 commit comments

Comments
 (0)