You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor let chains to nested if-let for Rust stable compatibility
This commit refactors all let chain expressions (if-let chains) into
nested if-let statements to ensure compatibility with Rust stable
without requiring unstable features or edition 2024.
Changes:
- Converted 12 let chain expressions across 6 files to nested if-let
- Updated Cargo.toml: edition 2024 → 2021
- Updated rust-toolchain.toml: version 1.90.0 → stable
The code was using let chains (e.g., `if let Some(x) = a && let Ok(y) = b`),
which is a convenient syntax for chaining conditional pattern matches. This
feature requires either:
- Rust 1.88+ with edition = "2024"
- Or the unstable #![feature(let_chains)] flag on nightly
Since the project was specifying edition = "2024" but had rust-toolchain.toml
pinned to 1.86.0 (which predates edition 2024 support), the code would not
compile without upgrading Rust versions.
Alternative approach:
If preferred, instead of this refactoring, the project could:
1. Update rust-toolchain.toml to channel = "1.88.0" (or later)
2. Keep edition = "2024" in Cargo.toml
3. Keep the let chain syntax as-is
The let chain syntax is more concise but requires a newer Rust version.
This refactoring maintains compatibility with older stable Rust versions
while keeping identical functionality.
All 91 existing tests pass with this change.
0 commit comments