rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Destructure assist in function arguments doesn't respect nested structures

Open 2ndDerivative opened this issue 1 year ago • 0 comments

I found this while working with nested function argument destructuring.

struct Outer<T>(T);
struct Inner {
    field: u32
}

fn stuff(Outer([...])) {
   ...
}

When typing "Inner" inside the Outer() brackets in fn stuff and accepting the assist for destructuring it will write this incorrect code:

fn stuff(Outer(Inner { field }: Inner))

instead of the correct

fn stuff(Outer(Inner { field }): Outer<Inner>)

I am not familiar with rust-analyzer's internals so I don't know how hard to fix it is but that's it.

2ndDerivative avatar Jul 01 '24 11:07 2ndDerivative