IntelliJ: rename pub struct Foo(pub ...) to pub struct Foo { inner: ... }

We have:

pub strut Foo (pub T);

Is there a way to rename this to

pub struct Foo {
  inner: T
}

so that all the Foo.0 become Foo.inner ?

Normally, if we are renaming the fields of a named struct, IntelliJ handles all refs fine.

My question is: can we rename from an unnamed_struct to a named_struct ?

I’m pretty sure there’s a “convert to/from tuple struct” intention but can’t check right now…

Edit: Yep, "convert to tuple" and "convert to struct".

1 Like