rust-refactor
rust-refactor copied to clipboard
Extract enum variant
Most useful for structs, the tuple case is not so important. E.g.,
enum Foo {
Foo,
Bar { a: A, b: B },
Baz(A, B)
}
to
enum Foo {
Foo,
Bar(Bar),
Baz(Baz)
}
pub struct Bar {
a: A,
b: B,
}
type Baz = (A, B);
I guess there should be a collapse case too, but that seems less useful. The fun part of this will be getting the pattern matching right.