aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/fill_struct_fields.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/fill_struct_fields.rs')
-rw-r--r--crates/ra_assists/src/fill_struct_fields.rs6
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 @@
1use std::fmt::Write; 1use std::fmt::Write;
2 2
3use hir::{AdtDef, Ty, db::HirDatabase, source_binder::function_from_child_node}; 3use hir::{AdtDef, db::HirDatabase, source_binder::function_from_child_node};
4 4
5use ra_syntax::ast::{self, AstNode}; 5use 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