rust-analyzer-ssr

Perform semantic code transformations in Rust projects using rust-analyzer's Structural Search and Replace.

Updated Jul 10, 2025
One-click install
npx skills add https://github.com/nubiv/my-nome --skill rust-analyzer-ssr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-analyzer-ssr
Source: https://github.com/nubiv/my-nome/tree/main/nix-darwin/config/claude/skills/rust-analyzer-ssr
Command: npx skills add https://github.com/nubiv/my-nome --skill rust-analyzer-ssr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enables powerful, semantic code transformations in Rust projects, going beyond simple text replacement to understand code structure and meaning.

Core Features & Use Cases

  • AST-based Search and Replace: Matches code by its Abstract Syntax Tree structure and semantic meaning, not just text.
  • Semantic Understanding: Understands type resolution and path equivalence for accurate transformations.
  • Use Cases: Refactoring APIs, converting code patterns (e.g., UFCS to method calls), finding specific code structures, and ensuring consistent code style semantically.

Quick Start

Use rust-analyzer's SSR to swap function arguments in the current file by applying the rule foo($a, $b) ==>> foo($b, $a).

Frequently Asked Questions about rust-analyzer-ssr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I perform semantic refactoring in Rust beyond simple text replacement?

You can perform semantic refactoring using rust-analyzer's Structural Search and Replace (SSR), which matches Abstract Syntax Tree structures and resolves path equivalence to execute context-aware code modifications.

What is Structural Search and Replace in rust-analyzer?

Structural Search and Replace (SSR) is an AST-based code transformation feature in rust-analyzer that understands type resolution and path equivalence to find specific code structures and ensure consistent semantic code style.

How do I swap function arguments in a Rust project using SSR?

You can swap function arguments by writing an SSR rule with placeholder variables, such as `foo($a, $b) ==>> foo($b, $a)`. This matches the AST pattern and executes the argument transformation contextually.

Can I use SSR for API migration and code pattern standardization in Rust?

Yes, SSR handles API migration and code pattern standardization by matching Abstract Syntax Tree structures. It effectively converts code patterns like Universal Function Call Syntax (UFCS) to method calls.

Does rust-analyzer SSR understand type resolution for code transformations?

Yes, rust-analyzer SSR understands type resolution and path equivalence. This semantic understanding ensures that code modifications are precise, context-aware, and not limited to syntactic text matching.

What are the limitations of AST-based code transformations in Rust?

AST-based code transformations depend on valid Abstract Syntax Tree structures and semantic meaning. Transformations require accurate path resolution and advanced constraints to ensure precise, context-aware modifications without breaking code.