diff options
Diffstat (limited to 'crates/ra_assists/src/fill_struct_fields.rs')
-rw-r--r-- | crates/ra_assists/src/fill_struct_fields.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_assists/src/fill_struct_fields.rs b/crates/ra_assists/src/fill_struct_fields.rs index 6e61a58fc..c7790dc72 100644 --- a/crates/ra_assists/src/fill_struct_fields.rs +++ b/crates/ra_assists/src/fill_struct_fields.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use std::fmt::Write; | 1 | use std::fmt::Write; |
2 | 2 | ||
3 | use hir::{AdtDef, Ty, db::HirDatabase, source_binder::function_from_child_node}; | 3 | use hir::{AdtDef, db::HirDatabase, source_binder::function_from_child_node}; |
4 | 4 | ||
5 | use ra_syntax::ast::{self, AstNode}; | 5 | use ra_syntax::ast::{self, AstNode}; |
6 | 6 | ||
@@ -60,8 +60,8 @@ where | |||
60 | let source_map = function.body_source_map(self.ctx.db); | 60 | let source_map = function.body_source_map(self.ctx.db); |
61 | let node_expr = source_map.node_expr(self.struct_lit.into())?; | 61 | let node_expr = source_map.node_expr(self.struct_lit.into())?; |
62 | let struct_lit_ty = infer_result[node_expr].clone(); | 62 | let struct_lit_ty = infer_result[node_expr].clone(); |
63 | let struct_def = match struct_lit_ty { | 63 | let struct_def = match struct_lit_ty.as_adt() { |
64 | Ty::Adt { def_id: AdtDef::Struct(s), .. } => s, | 64 | Some((AdtDef::Struct(s), _)) => s, |
65 | _ => return None, | 65 | _ => return None, |
66 | }; | 66 | }; |
67 | self.struct_fields = struct_def | 67 | self.struct_fields = struct_def |