mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Fill missing fields of enum variants
This commit is contained in:
parent
7db7c86881
commit
9549aad525
2 changed files with 40 additions and 7 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue