From 9549aad525845d5e401a71254d25ca92920de462 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 19 Feb 2020 17:53:32 +0100 Subject: Fill missing fields of enum variants --- crates/ra_ide/src/diagnostics.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'crates/ra_ide/src') diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index 82596c665..9cf86b26d 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs @@ -469,6 +469,35 @@ mod tests { check_apply_diagnostic_fix(before, after); } + #[test] + fn test_fill_struct_fields_enum() { + let before = r" + enum Expr { + Bin { lhs: Box, rhs: Box } + } + + impl Expr { + fn new_bin(lhs: Box, rhs: Box) -> Expr { + Expr::Bin { <|> } + } + } + + "; + let after = r" + enum Expr { + Bin { lhs: Box, rhs: Box } + } + + impl Expr { + fn new_bin(lhs: Box, rhs: Box) -> Expr { + Expr::Bin { lhs: (), rhs: () <|> } + } + } + + "; + check_apply_diagnostic_fix(before, after); + } + #[test] fn test_fill_struct_fields_partial() { let before = r" -- cgit v1.2.3