rust-rename
Skill120 starsChanged 16 days agoMITView on GitHub
Rename a Rust symbol across the workspace (an item, a method, a field, a module, a local variable) with `wado-dev-tools rust-rename`, which edits where rust-analyzer resolves the name rather than where the text matches. Read before any Rust rename.
In this repository37 other files it gives its agents.
- AGENTS.mdAGENTS.md
- benchmark/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- package-gale/AGENTS.mdAGENTS.md
- package-grog/AGENTS.mdAGENTS.md
- package-jade/AGENTS.mdAGENTS.md
- package-loam/AGENTS.mdAGENTS.md
- package-re/AGENTS.mdAGENTS.md
- package-wadopoet/AGENTS.mdAGENTS.md
- wado-cli/AGENTS.mdAGENTS.md
- wado-compiler/AGENTS.mdAGENTS.md
- wado-from-idl/AGENTS.mdAGENTS.md
- wado-host/AGENTS.mdAGENTS.md
- wado-lsp/AGENTS.mdAGENTS.md
- wado-manifest/AGENTS.mdAGENTS.md
- wado-run-pjrt/AGENTS.mdAGENTS.md
- wado-run-webgpu/AGENTS.mdAGENTS.md
- wado-vscode/AGENTS.mdAGENTS.md
- benchmarkSkill
- ci-timingSkill
- code-review-responseSkill
- coverage-investigationSkill
- crSkill
- debuggerSkill
- distillSkill
- git-upstream-syncSkill
- jcoSkill
- markdownSkill
- on-task-doneSkill
- optimizer-debugSkill
- profiling-wado-compilerSkill
- pull-requestSkill
- rustSkill
- vendor-submodulesSkill
- wado-cliSkill
- wado-performanceSkill
- wasm-optSkill
The file
Files
rust-rename
wado-dev-tools rust-rename asks rust-analyzer to rename a symbol and applies
the edit it returns, moving a renamed module's file and directory too.
scripts/dev-bin.sh wado-dev-tools rust-rename [--workspace DIR] [--dry-run] LOCATOR NEW_NAME--workspace DIRis the Cargo workspace to load, the current directory by default.wado-run-webgpu/is a workspace of its own, so a rename there passes--workspace wado-run-webgpu.--dry-runprints each site asfile:line:col: `old` -> `new`and writes nothing.- The server is the
rust-analyzerthat rustup resolves inDIR, sorust-toolchain.tomlpins its version.
Locators
A position is FILE:LINE:COLUMN, 1-based, with the column in bytes as
rg --column prints it. It reaches anything, a local variable included.
A symbol is a Rust path from the crate down, as rustdoc's intra-doc links write
one. The crate may be written as its package name (wado-compiler).
| Names | Notation |
| An item | my_crate::geo::Point |
| A method or assoc. item | my_crate::geo::Point::area |
| A field or enum variant | my_crate::geo::Point::x |
| A module | my_crate::geo |
| A trait member, every impl | my_crate::geo::Shape::area |
Type::name names an inherent member only. A trait-impl member is named
through its trait, and the rename reaches the trait and every impl. A local
variable has no path, so it takes a position. A notation that names no symbol,
or several, fails and lists the candidates' positions to pass instead.
Cost
Each call starts rust-analyzer, which loads the workspace before it renames,
running cargo check for the build scripts and proc macros. Loading is nearly
the whole call, so a rename of thousands of sites costs about what a rename of
two does. Run it in the background.
What it leaves
rust-analyzer does not rename these, so the old name stays:
- a
macro_rules!body, whose tokens name nothing until the macro expands; - code behind a
cfgthe Cargo workspace does not enable; - comments and string literals.
Find them and fix each with the editing tools:
cargo check --workspace --all-targets
rg -n '\bOLD_NAME\b'What it refuses
Nothing is written when the rename would edit a file outside DIR, as renaming
the member of a standard library trait's impl would edit the sysroot. A module
rename stops before moving a file onto an existing path.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

