rust-lang / rust-lang/rust-analyzer
Inverse to `move_module_to_file`; move module to inline
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
In a project which has a ton of "noise" wrt module structure, I find it nice to inline modules into their relevant files, to be able to use modules as semantic units for library API isolation.
Example of the project structure;

get_public_rooms_filtered.rs is then simply;
pub mod v1;
It'd be nice if I could do the reverse of move_module_to_file, and have a code action on that module identifier that would move the entire file to the inline module, and take care of removing the corresponding file (and folder, if it's then empty).
Suggested name; move_module_to_inline
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing move_module_to_file implementation and its code action entry point. Trace how it moves module contents and handles the source file, then implement the inverse for move_module_to_inline; done means the module is inlined and the corresponding file and any empty folder are removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100