vscode-rust
vscode-rust copied to clipboard
Propose to refer to struct as Self
A yellow light bulb should appear that proposes that the user renames the return type to Self.
From:
struct Foo {
bar: u8,
}
impl Foo {
fn new(bar: u8) -> Foo {
Foo { bar }
}
}
Into:
struct Foo {
bar: u8,
}
impl Foo {
fn new(bar: u8) -> Self { // Foo into Self
Self { bar } // Foo into Self
}
}