aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-03-17 18:37:09 +0000
committerFlorian Diebold <[email protected]>2019-03-21 21:17:00 +0000
commit8a5fbf471305894094726834f7701747fce9c961 (patch)
treed210d1a25099ca381bac2f0f2f3247fbd69b366d /crates/ra_assists
parent7a8ba535422a4e3d2b649acde75b5c400ef5e7c6 (diff)
Remove the old variants replaced by Ty::Apply
Diffstat (limited to 'crates/ra_assists')
-rw-r--r--crates/ra_assists/src/fill_match_arms.rs14
-rw-r--r--crates/ra_assists/src/fill_struct_fields.rs6
2 files changed, 8 insertions, 12 deletions
diff --git a/crates/ra_assists/src/fill_match_arms.rs b/crates/ra_assists/src/fill_match_arms.rs
index 6a22b0af5..da67ab667 100644
--- a/crates/ra_assists/src/fill_match_arms.rs
+++ b/crates/ra_assists/src/fill_match_arms.rs
@@ -1,7 +1,7 @@
1use std::fmt::Write; 1use std::fmt::Write;
2 2
3use hir::{ 3use hir::{
4 AdtDef, Ty, FieldSource, source_binder, 4 AdtDef, FieldSource, source_binder,
5 db::HirDatabase, 5 db::HirDatabase,
6}; 6};
7use ra_syntax::ast::{self, AstNode}; 7use ra_syntax::ast::{self, AstNode};
@@ -26,14 +26,10 @@ pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<As
26 let source_map = function.body_source_map(ctx.db); 26 let source_map = function.body_source_map(ctx.db);
27 let node_expr = source_map.node_expr(expr)?; 27 let node_expr = source_map.node_expr(expr)?;
28 let match_expr_ty = infer_result[node_expr].clone(); 28 let match_expr_ty = infer_result[node_expr].clone();
29 let enum_def = match match_expr_ty { 29 let enum_def = match_expr_ty.autoderef(ctx.db).find_map(|ty| match ty.as_adt() {
30 Ty::Adt { def_id: AdtDef::Enum(e), .. } => e, 30 Some((AdtDef::Enum(e), _)) => Some(e),
31 Ty::Ref(adt, _) => match *adt { 31 _ => None,
32 Ty::Adt { def_id: AdtDef::Enum(e), .. } => e, 32 })?;
33 _ => return None,
34 },
35 _ => return None,
36 };
37 let enum_name = enum_def.name(ctx.db)?; 33 let enum_name = enum_def.name(ctx.db)?;
38 let db = ctx.db; 34 let db = ctx.db;
39 35
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