nubiv/my-nome/rust-analyzer-ssr
- community
Checking that the SKILL.md file is still in the repository.
Use rust-analyzer's Structural Search and Replace (SSR) to change lots of Rust code. SSR matches by AST structure and semantic meaning, understanding type resolution and path equivalence.
Install
npx vskill@latest install nubiv/my-nome/rust-analyzer-ssrSKILL.md
rust-analyzer Structural Search and Replace (SSR)
Use rust-analyzer's SSR for semantic code transformations in Rust projects. SSR matches code by AST structure and semantic meaning, not text.
When to Use
- Refactoring patterns across a codebase (rename, restructure, migrate APIs)
- Converting between equivalent forms (UFCS to method calls, struct literals to constructors)
- Finding all usages of a specific code pattern
- Semantic-aware search that understands type resolution
Basic Syntax
Placeholders capture matched code:
$name— matches any expression/type/pattern in that position${name:constraint}— matches with constraints
Common Patterns
Swap function arguments
Convert struct literal to constructor
UFCS to method call
Method to UFCS
Wrap in Result
Unwrap to expect
Match only literals
Match non-literals
Constraints
| Constraint | Matches | |
|---|---|---|
kind(literal) | Literal values: 42, "foo", true | |
not(...) | Negates inner constraint |
How to Invoke
Via Comment Assist (Interactive)
Write a comment containing an SSR rule, then trigger code actions:
Actions appear: "Apply SSR in file" or "Apply SSR in workspace"
Via LSP Command
Via CLI
Key Behaviors
Path Resolution: Paths match semantically. foo::Bar matches Bar if imported from foo.
Auto-qualification: Replacement paths are qualified appropriately for each insertion site.
Parenthesization: Automatic parens added when needed (e.g., $a + $b becoming ($a + $b).method()).
Comment Preservation: Comments within matched ranges are preserved.
Macro Handling
SSR can match code inside macro expansions, but with an important restriction: all matched tokens must originate from the same source.
Example: Macro Boundary
The expanded code is foo(bar, 42). Here:
baroriginates from the call site (what the user wrote)foo,42originate from the macro definition
If you search for foo($a, $b):
- It would NOT match the expanded
foo(bar, 42)because$awould capturebar(call site) but$bwould capture42(definition site) — these cross the macro boundary.
Why This Limitation Exists
SSR can only generate edits for code the user actually wrote. If a match spans both user code and macro-generated code, SSR couldn't produce a valid edit — it would need to modify the macro definition, which is a different (and potentially shared) piece of code.
What SSR CAN Do With Macros
- Match code entirely within macro arguments:
my_macro!(foo($a))can matchfoo($a) - Match the macro call itself:
my_macro!($x)works - Match expanded code where all tokens come from call-site arguments
Other Limitations
- Constraints limited to
kind(literal)andnot() - Single-identifier patterns (
foo ==>> bar) may be filtered if ambiguous - Cannot modify
usedeclarations with braces
More Examples
Convert Option methods
Change field access
Reorder struct fields
Generic type transformation
Source Files
- Core implementation:
crates/ide-ssr/src/ - IDE integration:
crates/ide/src/ssr.rs - Tests with examples:
crates/ide-ssr/src/tests.rs
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingnix-darwin/config/claude/skills/rust-analyzer-ssr/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/nubiv/my-nome/rust-analyzer-ssr)