diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-06 14:46:03 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-06 14:46:03 +0000 |
commit | 995a92814ffda2e9c4b46392c6293bbdce4b3cc1 (patch) | |
tree | 384f143b6f5454a6ff515ab387b2fc1a9d44bf29 /crates/ra_ide/src | |
parent | 13879afdd58f7cd9fe34843c5b09ba9c22de1e77 (diff) | |
parent | 073a1ef834be5e2e1ae6733c6c299d2ae68050d8 (diff) |
Merge #3490
3490: Support aliases and Self in struct literals r=matklad a=flodiebold
Fixes #3306.
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_ide/src')
-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 { |