diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-22 16:47:22 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-22 16:47:22 +0100 |
commit | eabbeec14c6624fb93344c25ecd79fe61972abbc (patch) | |
tree | 3ea368dc86059e903dd5c0b4b19cf78f50b63be3 /crates/ra_ide | |
parent | 87615166af84a4822adc4686fd9ee44fafa51f53 (diff) | |
parent | acc2819c10ce1eb9daadac606c3ab6cfbfa91851 (diff) |
Merge #4988
4988: Don't offer to add missing fields of unknown types r=flodiebold a=lnicola
Co-authored-by: Laurențiu Nicola <[email protected]>
Diffstat (limited to 'crates/ra_ide')
-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()?), |