mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
![bors[bot]](/assets/img/avatar_default.png)
10076: Use struct init shorthand when applicable in fill struct fields assist r=matklad a=nathanwhit This PR tweaks the fill struct fields assist to use the struct init shorthand when a local variable with a matching name and type is in scope. For example: ```rust struct Foo { a: usize, b: i32, c: char, } fn main() { let a = 1; let b = 2; let c = 3; let foo = Foo { <|> }; } ``` Before we would insert ```rust Foo { a: (), b: (), c: (), } ``` now we would insert ```rust Foo { a, b, c: () } ``` Co-authored-by: nathan.whitaker <nathan.whitaker01@gmail.com>