Fill missing fields of enum variants

This commit is contained in:
Aleksey Kladov 2020-02-19 17:53:32 +01:00
parent 7db7c86881
commit 9549aad525
2 changed files with 40 additions and 7 deletions

View file

@ -469,6 +469,35 @@ mod tests {
check_apply_diagnostic_fix(before, after);
}
#[test]
fn test_fill_struct_fields_enum() {
let before = r"
enum Expr {
Bin { lhs: Box<Expr>, rhs: Box<Expr> }
}
impl Expr {
fn new_bin(lhs: Box<Expr>, rhs: Box<Expr>) -> Expr {
Expr::Bin { <|> }
}
}
";
let after = r"
enum Expr {
Bin { lhs: Box<Expr>, rhs: Box<Expr> }
}
impl Expr {
fn new_bin(lhs: Box<Expr>, rhs: Box<Expr>) -> Expr {
Expr::Bin { lhs: (), rhs: () <|> }
}
}
";
check_apply_diagnostic_fix(before, after);
}
#[test]
fn test_fill_struct_fields_partial() {
let before = r"