Support aliases and Self in struct literals

Fixes #3306.
This commit is contained in:
Florian Diebold
2020-03-06 15:26:49 +01:00
parent 1cc6879576
commit 073a1ef834
3 changed files with 95 additions and 1 deletions

View File

@@ -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"