skills/emillindfors/rust-2024-migration/SKILL.md
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.
npx skillsauth add aiskillstore/marketplace rust-2024-migrationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
Activate when you notice:
What to Look For: Nested if-let or match expressions
Before (Nested):
// ❌ 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):
// ✅ 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.
Before:
// ❌ 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:
// ✅ Native async closure
let futures: Vec<_> = items
.iter()
.map(async |item| {
fetch_data(item).await
})
.collect();
Before:
// ❌ OLD: Required async-trait crate
use async_trait::async_trait;
#[async_trait]
trait UserRepository {
async fn find_user(&self, id: &str) -> Result<User, Error>;
}
After:
// ✅ NEW: Native async fn in traits (Rust 1.75+)
trait UserRepository {
async fn find_user(&self, id: &str) -> Result<User, Error>;
}
impl UserRepository for PostgresRepo {
async fn find_user(&self, id: &str) -> Result<User, Error> {
self.db.query(id).await // No macro needed!
}
}
When async-trait is Still Needed:
// For dynamic dispatch (dyn Trait)
use async_trait::async_trait;
#[async_trait]
trait Plugin: Send + Sync {
async fn execute(&self) -> Result<(), Error>;
}
// This requires async-trait:
let plugins: Vec<Box<dyn Plugin>> = vec![
Box::new(PluginA),
Box::new(PluginB),
];
Rust 2024 Changes:
// Rust 2024: mut doesn't force by-value
match &data {
Some(mut x) => {
// x is &mut T (not T moved)
x.modify(); // Modifies through reference
}
None => {}
}
Before (Manual Iterator):
struct RangeIter {
current: i32,
end: i32,
}
impl Iterator for RangeIter {
type Item = i32;
fn next(&mut self) -> Option<Self::Item> {
if self.current < self.end {
let result = self.current;
self.current += 1;
Some(result)
} else {
None
}
}
}
After (Gen Block):
fn range_iter(start: i32, end: i32) -> impl Iterator<Item = i32> {
gen {
let mut current = start;
while current < end {
yield current;
current += 1;
}
}
}
When migrating to Rust 2024:
[package]
edition = "2024"
rust-version = "1.85" # Minimum version for Rust 2024
cargo fix --edition
When you see code patterns:
Proactively suggest Rust 2024 patterns for more elegant, idiomatic code.
development
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.