aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-02-19 16:53:32 +0000
committerAleksey Kladov <[email protected]>2020-02-19 17:17:09 +0000
commit9549aad525845d5e401a71254d25ca92920de462 (patch)
treebf1cc13ddb0fd6b45e6a19789d5e3cd79caaf904 /crates/ra_ide/src
parent7db7c868812c7289626825988fb6e610ea747eeb (diff)
Fill missing fields of enum variants
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/diagnostics.rs29
1 files changed, 29 insertions, 0 deletions
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
@@ -470,6 +470,35 @@ mod tests {
470 } 470 }
471 471
472 #[test] 472 #[test]
473 fn test_fill_struct_fields_enum() {
474 let before = r"
475 enum Expr {
476 Bin { lhs: Box<Expr>, rhs: Box<Expr> }
477 }
478
479 impl Expr {
480 fn new_bin(lhs: Box<Expr>, rhs: Box<Expr>) -> Expr {
481 Expr::Bin { <|> }
482 }
483 }
484
485 ";
486 let after = r"
487 enum Expr {
488 Bin { lhs: Box<Expr>, rhs: Box<Expr> }
489 }
490
491 impl Expr {
492 fn new_bin(lhs: Box<Expr>, rhs: Box<Expr>) -> Expr {
493 Expr::Bin { lhs: (), rhs: () <|> }
494 }
495 }
496
497 ";
498 check_apply_diagnostic_fix(before, after);
499 }
500
501 #[test]
473 fn test_fill_struct_fields_partial() { 502 fn test_fill_struct_fields_partial() {
474 let before = r" 503 let before = r"
475 struct TestStruct { 504 struct TestStruct {