rust-lang / rust-lang/rust-analyzer
Assist: extract_sub_struct
Open
Nobody has claimed this yet.
A-assists
C-feature
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
struct Foo {
$0name: String,
id: u32$0,
counter: u32,
}
impl Foo {
fn clear(&mut self) {
self.name.clear();
self.id = 0;
}
fn init_id(&mut self) {
self.id = self.counter;
self.counter += 1;
}
}
->
struct NewStruct {
name: String,
id: u32
}
impl NewStruct {
fn clear(&mut self) {
self.name.clear();
self.id = 0;
}
}
struct Foo {
new_struct$0: NewStruct,
counter: u32,
}
impl Foo {
fn init_id(&mut self) {
self.new_struct.id = self.counter;
self.counter += 1;
}
}
@rustbot label +A-assists
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
The issue names no source files, tests, or entry points. Start by locating rust-analyzer's assist implementation and related tests for extract_sub_struct; done means extracting the selected fields into a new struct, moving methods that use only those fields, and updating the remaining field accesses as shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100