diff options
author | Laurențiu Nicola <[email protected]> | 2020-06-22 16:16:00 +0100 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2020-06-22 16:16:00 +0100 |
commit | acc2819c10ce1eb9daadac606c3ab6cfbfa91851 (patch) | |
tree | e4d91e2019d04babec646772fab4df5c5d746753 | |
parent | 5a0331e5575034a145956f76316ee0fcdf72077e (diff) |
Don't offer to add missing fields of unknown types
-rw-r--r-- | crates/ra_ide/src/diagnostics.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index a88a978d7..9bde1db8e 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs | |||
@@ -167,6 +167,9 @@ fn missing_struct_field_fix( | |||
167 | }; | 167 | }; |
168 | 168 | ||
169 | let new_field_type = sema.type_of_expr(&record_expr.expr()?)?; | 169 | let new_field_type = sema.type_of_expr(&record_expr.expr()?)?; |
170 | if new_field_type.is_unknown() { | ||
171 | return None; | ||
172 | } | ||
170 | let new_field = make::record_field_def( | 173 | let new_field = make::record_field_def( |
171 | record_expr.field_name()?, | 174 | record_expr.field_name()?, |
172 | make::type_ref(&new_field_type.display_source_code(sema.db, module.into()).ok()?), | 175 | make::type_ref(&new_field_type.display_source_code(sema.db, module.into()).ok()?), |