mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
Merge #4988
4988: Don't offer to add missing fields of unknown types r=flodiebold a=lnicola Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
This commit is contained in:
commit
eabbeec14c
1 changed files with 3 additions and 0 deletions
|
@ -167,6 +167,9 @@ fn missing_struct_field_fix(
|
|||
};
|
||||
|
||||
let new_field_type = sema.type_of_expr(&record_expr.expr()?)?;
|
||||
if new_field_type.is_unknown() {
|
||||
return None;
|
||||
}
|
||||
let new_field = make::record_field_def(
|
||||
record_expr.field_name()?,
|
||||
make::type_ref(&new_field_type.display_source_code(sema.db, module.into()).ok()?),
|
||||
|
|
Loading…
Reference in a new issue