From 073a1ef834be5e2e1ae6733c6c299d2ae68050d8 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 6 Mar 2020 15:26:49 +0100 Subject: Support aliases and Self in struct literals Fixes #3306. --- crates/ra_ide/src/diagnostics.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'crates/ra_ide/src') 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 @@ -472,6 +472,33 @@ mod tests { check_apply_diagnostic_fix(before, after); } + #[test] + fn test_fill_struct_fields_self() { + let before = r" + struct TestStruct { + one: i32, + } + + impl TestStruct { + fn test_fn() { + let s = Self {}; + } + } + "; + let after = r" + struct TestStruct { + one: i32, + } + + impl TestStruct { + fn test_fn() { + let s = Self { one: ()}; + } + } + "; + check_apply_diagnostic_fix(before, after); + } + #[test] fn test_fill_struct_fields_enum() { let before = r" -- cgit v1.2.3