rust-syntax-pattern-matching

Installation
SKILL.md
Contains Shell Commands

This skill contains shell command directives (!`command`) that may execute system commands. Review carefully before installing.

rust-syntax-pattern-matching

The mechanics of pattern matching in Rust: match, if let, let else, while let, if-let chains (edition 2024, stable in 1.88), destructuring of tuples / structs / enums / slices / references, ref and ref mut, or-patterns, guards, @ bindings, .. rest patterns, range patterns, and literal patterns.

Cross-references: [[rust-syntax-edition-2024]] (if-let chain edition-gating, if let temporary scope change) [[rust-syntax-ownership]] (move vs borrow in match arms, when ref matters)


When to use this skill

  • User writes a match and gets E0004 ("non-exhaustive patterns") or wants to know which arms are missing
  • User asks "should I use match, if let, or let else here"
  • User wonders why their if let chain is rejected (edition or version too old)
  • User destructures a tuple, struct, enum, slice, or reference and the compiler complains about moves
  • User asks what ref / ref mut does and when to reach for it
  • User wants or-patterns (A | B), guards (if cond), or @ bindings explained
  • User asks about .. rest patterns in structs or slices
  • User writes a range pattern (1..=10) or asks about exclusive ranges in patterns (stable in 1.80)
  • User gets E0408 (variable not bound in all patterns) or E0409 (variable bound with different mode/type)
Installs
2
GitHub Stars
1
First Seen
May 24, 2026