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

Propose to box parameter if it's a struct

Open vanillajonathan opened this issue 4 years ago • 0 comments

When a user hovers the cursor over a method parameter, a yellow light bulb should appear that lets wrap it into a box.

From:

struct Foo {
    bar: &Bar,
}

struct Bar;

impl Foo {
    fn new(bar: &Bar) -> Self {
        Foo { bar }
    }
}

Into:

struct Foo {
    bar: &Box<Bar>,
}

struct Bar;

impl Foo {
    fn new(bar: &Box<Bar>) -> Self {
        Foo { bar }
    }
}

vanillajonathan avatar Nov 04 '20 19:11 vanillajonathan