refactor(semantic, transformer, react_compiler): use if-let match guards#24383
Merged
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
Member
Author
Merge activity
|
…rds (#24383) Rust 1.95 stabilized if-let guards in match arms (MSRV bumped in #24359). This converts the three places which guard on `is_some()` and then re-extract the same value in the body — the guard now binds the value directly: - `oxc_semantic` `binder.rs` — `export_decl.declaration.is_some()` guard followed by `.as_ref().unwrap()`. - `oxc_transformer` `typescript/annotations.rs` — `decl.declaration.is_some()` guard followed by an `is_some_and` re-check. - `oxc_react_compiler` `validate_preserved_manual_memoization.rs` — `state.manual_memo_state.is_some()` guard followed by `.as_mut().unwrap()`; the guard now binds `&mut` directly. The sibling `StoreLocal` arm used the same unwrap idiom in a body `if`, converted to a let chain for consistency. I audited the other ~15 `is_some()` match guards in the workspace: they only test the value without extracting it in the body, so they stay as plain guards. Verified: crate tests pass, semantic coverage suites and Babel transform conformance produce **zero snapshot diffs**, clippy clean for the changed files. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
graphite-app
Bot
force-pushed
the
refactor-if-let-guards
branch
from
July 11, 2026 11:11
148dad4 to
b6d2a29
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rust 1.95 stabilized if-let guards in match arms (MSRV bumped in #24359). This converts the three places which guard on
is_some()and then re-extract the same value in the body — the guard now binds the value directly:oxc_semanticbinder.rs—export_decl.declaration.is_some()guard followed by.as_ref().unwrap().oxc_transformertypescript/annotations.rs—decl.declaration.is_some()guard followed by anis_some_andre-check.oxc_react_compilervalidate_preserved_manual_memoization.rs—state.manual_memo_state.is_some()guard followed by.as_mut().unwrap(); the guard now binds&mutdirectly. The siblingStoreLocalarm used the same unwrap idiom in a bodyif, converted to a let chain for consistency.I audited the other ~15
is_some()match guards in the workspace: they only test the value without extracting it in the body, so they stay as plain guards.Verified: crate tests pass, semantic coverage suites and Babel transform conformance produce zero snapshot diffs, clippy clean for the changed files.
🤖 Generated with Claude Code