Guides users through migrating to Rust 2024 edition features including let chains, async closures, and improved match ergonomics. Activates when users work with Rust 2024 features or nested control flow.
View on GitHubEmilLindfors/claude-marketplace
rust-modern-patterns
plugins/rust-modern-patterns/skills/rust-2024-migration/SKILL.md
January 20, 2026
Select agents to install to:
npx add-skill https://github.com/EmilLindfors/claude-marketplace/blob/main/plugins/rust-modern-patterns/skills/rust-2024-migration/SKILL.md -a claude-code --skill rust-2024-migrationInstallation paths:
.claude/skills/rust-2024-migration/# Rust 2024 Migration Skill
You are an expert at modern Rust patterns from the 2024 edition. When you detect code that could use Rust 2024 features, proactively suggest migrations and improvements.
## When to Activate
Activate when you notice:
- Nested if-let expressions
- Manual async closures with cloning
- Cargo.toml with edition = "2021" or earlier
- Code patterns that could benefit from Rust 2024 features
## Rust 2024 Feature Patterns
### 1. Let Chains (Stabilized in 1.88.0)
**What to Look For**: Nested if-let or match expressions
**Before (Nested)**:
```rust
// ❌ Deeply nested, hard to read
fn process_user(id: &str) -> Option<String> {
if let Some(user) = db.find_user(id) {
if let Some(profile) = user.profile {
if profile.is_active {
if let Some(email) = profile.email {
return Some(email);
}
}
}
}
None
}
```
**After (Let Chains)**:
```rust
// ✅ Flat, readable chain
fn process_user(id: &str) -> Option<String> {
if let Some(user) = db.find_user(id)
&& let Some(profile) = user.profile
&& profile.is_active
&& let Some(email) = profile.email
{
Some(email)
} else {
None
}
}
```
**Suggestion Template**:
```
Your nested if-let can be flattened using let chains (Rust 2024):
if let Some(user) = get_user(id)
&& let Some(profile) = user.profile
&& profile.is_active
{
// All conditions met
}
This requires Rust 1.88+ and edition = "2024" in Cargo.toml.
```
### 2. Async Closures (Stabilized in 1.85.0)
**Before**:
```rust
// ❌ Manual async closure with cloning
let futures: Vec<_> = items
.iter()
.map(|item| {
let item = item.clone(); // Need to clone for async move
async move {
fetch_data(item).await
}
})
.collect();
```
**After**:
```rust
// ✅ Native async closure
let futures: Vec<_> = items
.iter()
.map(async |item| {
fetch