diff options
author | Florian Diebold <[email protected]> | 2020-03-06 14:26:49 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2020-03-06 14:43:14 +0000 |
commit | 073a1ef834be5e2e1ae6733c6c299d2ae68050d8 (patch) | |
tree | 516d9694de4f960d886c66b702014ec56bc2ebc2 /crates/ra_ide | |
parent | 1cc6879576b04850db3dd8aa1df0cf7c8f270503 (diff) |
Support aliases and Self in struct literals
Fixes #3306.
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/diagnostics.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index a52f7fdd9..a10e642db 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs | |||
@@ -473,6 +473,33 @@ mod tests { | |||
473 | } | 473 | } |
474 | 474 | ||
475 | #[test] | 475 | #[test] |
476 | fn test_fill_struct_fields_self() { | ||
477 | let before = r" | ||
478 | struct TestStruct { | ||
479 | one: i32, | ||
480 | } | ||
481 | |||
482 | impl TestStruct { | ||
483 | fn test_fn() { | ||
484 | let s = Self {}; | ||
485 | } | ||
486 | } | ||
487 | "; | ||
488 | let after = r" | ||
489 | struct TestStruct { | ||
490 | one: i32, | ||
491 | } | ||
492 | |||
493 | impl TestStruct { | ||
494 | fn test_fn() { | ||
495 | let s = Self { one: ()}; | ||
496 | } | ||
497 | } | ||
498 | "; | ||
499 | check_apply_diagnostic_fix(before, after); | ||
500 | } | ||
501 | |||
502 | #[test] | ||
476 | fn test_fill_struct_fields_enum() { | 503 | fn test_fill_struct_fields_enum() { |
477 | let before = r" | 504 | let before = r" |
478 | enum Expr { | 505 | enum Expr { |